This came up during testing where I have to compare values between actual output and expected output.
Code:
float nf = 584227.4649743827f;
printf("Output: \t %.9f \n", nf);
Output:
Output:  584227.437500 
I clearly have some gaps in my knowledge in C, so could someone explain to me this situation:
- Why is there this deviation (0.027474382659420f) in the print ?
- Is this only the limitation of print, or is it the float data type limitation?
- which value is actually stored in the variable nf?
- How should I work with values like this so I don't lose information like having a deviation of 0.027474382659420fduring assignment.
Any other suggestion related to this kind of problem in testing would be also much appriciated.
 
     
    