int main()
{
float x=3.4e2;
printf("%f",x);
return 0;
}
Output:
340.000000 // It's ok.
But if write x=3.1234e2
the output is 312.339996
and if x=3.12345678e2
the output is 312.345673
.
Why are the outputs like these? I think if I write x=3.1234e2
the output should be 312.340000
, but the actual output is 312.339996
using GCC compiler.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…