|
Note that a floating-point constant in the source code is treated as being of the type
double. This can cause innocent-looking expressions to be evaluated in double
precision. In the example below a is converted from a float to a double, 1 is added
and the result is converted back to a float:
float test(float a)
{
return a+1.0;
}
To treat a floating-point constant as a float rather than as a double, add an f to it, for
example:
float test(float a)
{
return a+1.0f;
}
E-mail: info@telesys.ru