I am encountering a weird problem using double datatype in my VC++ application.
double x = 132.23
When I debug what "x" is actually having, it shows me "132.22999999999999"
I thought this is understood because as double stores the floating point numbers in base 2 and as 0.23 CANNOT be absolutely represented in base 2, there is some rounding issue when converting back to decimal and so I see an error of .00000000000001 due to precision limits.
However, when I change it to
double x = 132.16
X shows to be having exactly "132.16"!!
I dont understand how this is possible because I thought .16 cannot be absolutely represented in base 2!
Why do I see this difference? Any help would be greatly appreciated