In a sample program, I found some strange declaration in it.
what do they mean? Simply deltaY = 1.0 and halfDeltaY = 0.5?Code:float deltaY = 1.0f;
float halfDeltaY = .5f;
Printable View
In a sample program, I found some strange declaration in it.
what do they mean? Simply deltaY = 1.0 and halfDeltaY = 0.5?Code:float deltaY = 1.0f;
float halfDeltaY = .5f;
if you write a floating point literal in C++ (i.e. 3.14) the compiler interprets it as a double precision float (or more simple as type double).
the f suffix simply tells the compiler you're explicitly requesting a float type.
this is present with other literals as well
Code:int x = 1;
int y = 010; // is actually octal
assert(y == 8);
unsigned char = 128u; // tells the compiler the value is unsigned (i.e. 0 to 255, instead of -128 to 127)