c - Compile time constants as floats -
To change the compiler (MSCV 2005) after changing the file with the pair double
Warns about conversion from float
to code constant
... float r; R = (q1 + q2) * 0.5; ...
Even q1, q2
both floats 0.5
as double
Is considered in.
How to optimize this behavior, so that all in-code stabilizations are considered as float
s? Use a f
suffix for
float q1 = ...; float q2 = ...; float r = (q1 + q2) * 0.5 f;
The standard (§6.4.4.2 floating constant) states:
An unrecognized floating continuous type is
double
if the letterf
orF
, then its type isfloat
if the letter sticks withL
orL
, its type is < C Ode is a long double .
Fixed your question is not a suffix and therefore type is double
.
Comments
Post a Comment