Originally Posted by
KCfromNC
Q3 : F means the constant is single precision floating point. Without it, constants with a decimal point in them are considered doubles. Probably doesn't matter in most cases, but there may be some unexpected stuff that happens if the value can be represented by a double but not a float.
The bigger problem is when people use integer constants and expect a floating point value.
float f = 1/2;
f will be zero. The two constants are integers, 1/2 in integer math is 0 since you can't represent a fraction in an integer. This 0 is then converted into 0.0f and assigned to the variable, and you see problems later. This can be fixed in several ways :
float f = (float)1/2;
float f = 1f/2;
float f = 1./2;
and so on. Just something to make sure at least one of the vars is floating point.