Improve floating-point number handling

This pull request enables warnings for suspicious implicit casts, and fixes all warnings generated by enabling those warnings.

This involved switching from the use of float or double-specific functions (for example, floor vs floorf) to using CGFloat as the floating-point type and <tgmath.h> for the function prototypes. This results in code that works correctly and with the native floating-point width on both 32-bit and 64-bit platforms, and is warning-free!
Are you sure this is ok? random() and RAND_MAX are both integers, but we want floating point division. I can't test this right now.