sprang / Inkpad

Vector illustration app for the iPad.
Mozilla Public License 2.0
2.64k stars 474 forks source link

Fix Xcode7 compile error #147

Closed robotbear2077 closed 9 years ago

robotbear2077 commented 9 years ago

Absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value.

rhcad commented 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!

robotbear2077 commented 9 years ago

@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.

rhcad commented 9 years ago

I think you are write. Thank you.