i would like to know what is my problem when i try to print some float values, for example, in this simple programme :
float n = 127.998 ;
printf("%f",n);
The execution gives : 127.998001.
- So why i have the additional 1 back of this number ?
i would like to know what is my problem when i try to print some float values, for example, in this simple programme :
float n = 127.998 ;
printf("%f",n);
The execution gives : 127.998001.
Some values cannot be accurately stored in a floating point data type. There is no guarantee that your float n = 127.998
will actually be stored as exactly 127.998
. For values that cannot be accurately represented in floating point types, the closest value to that is stored instead, which is what you got.