Design Element
Comment on "Cocoa Graphics Frameworks"
by Jean-Franois Roy — Sep 22
"I've mostly used the form without the suffix, simply because I did find it more readable, but is this something official that I need the adhere to?

It also says the change makes ready for conversion to 64 bit. What difference does it make?"

It's a simple matter of precision. By using x.y, the compiler will generate doubles, which will be implicitly converted to floats if assigned to float variables, such as used in Quartz in 32 bits program. When you flick the 64 bits switch, you'll magically get double the precision you had in your draw code.

By using x.yf, the compiler will generate a float, and if you then assign that float to a double variable, the compiler will also generate an implicit type conversion and further math using that double variable will benefit from the added precision.

However, if in your various classes and algorithms you have float member variables or local variables, then you will not get those benefits, and even risk accentuating rounding errors.
Back to "Cocoa Graphics Frameworks"
Design Element

Copyright © Scott Stevenson 2004-2015