Closed robotbear2077 closed 9 years ago
I don't think so.
The right fix may be int segments = ceilf(fabsf(thetaArc / ((float)M_PI_2 + 0.001f)))
rather than ceilf(fabs(thetaArc / (M_PI_2 + 0.001f)))
. Because M_PI_2 is a double value and a double value will pass to the function ceilf
in your PR.
Thank you!
@rhcad , thanks for your quick reply.
Sorry I didn't think much more then, my fix just takes the xcode's auto-fix suggestion, and the compiler seems happy with passing double value to ceilf
, since you just want the integer part, so may be the precision doesn't matter here with ceilf
?
Your suggestion is good for type consistency, but I don't think downcast the precision of M_PI_2
is a good choice, after all, precision does matter when it comes to fabs
and fabsf
, and the compiler did whining about it.
I think you are write. Thank you.
Absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value.