T
Tony Johansson
Hello!
Can somebody explain why I get 1.0000000149011612 when doing this expression
calculation ?
double d = 0.2f + 0.2f + 0.2f + 0.2f + 0.2f;
I know how to fix it that is not the question is about.
I now that a double have more then double as many significant number then a
float but can't
still understand the result.
If I instead change the type of d to float I get the expected result of 1.0.
I can also change the type of 0.2 to a double which also give the correct
result of 1.0
//Tony
Can somebody explain why I get 1.0000000149011612 when doing this expression
calculation ?
double d = 0.2f + 0.2f + 0.2f + 0.2f + 0.2f;
I know how to fix it that is not the question is about.
I now that a double have more then double as many significant number then a
float but can't
still understand the result.
If I instead change the type of d to float I get the expected result of 1.0.
I can also change the type of 0.2 to a double which also give the correct
result of 1.0
//Tony