Yes, 135.24 cannot be represented by double since double uses binary exponential notation.
That is: 135.24 can be represented exponentially in base of 2 as 1.0565625 * 128 = ( 1 + 1/32 + 1/64 + 1/128 + 1/1024 + ... ) * (2**7).
The representation cannot be done exactly, because 13524 does not divide by 5. Let's look:
135.24 = 13524/(10**2)
representation is finite <=>
exist whole x and n satisfying 135.24 = x/(2**n)
135.24 = x/(2**n)
13524 / (10**2) = x / (2**n)
13524 * (2**n) = (10**2) * x
13524 * (2**n) = 2*2*5*5 * x
there is no "5" on the left side, so it cannot be done
(known as the Fundamental Theorem of Arithmetic)
In general, finite binary representation is exact only if there is sufficient number of "fives" in prime factorization of the decimal number.
Now the fun part:
double delta = 0.5;
while( 1 + delta > 1 )
delta /= 2;
Console.WriteLine( delta );
Precision of double is different near 1, different near 0, and different for some big numbers. Some binary representation examples on Wikipedia: Double precision floating point format
But the most important thing is that internal processor floating-point stack may have much better precision than 8 bytes (double). If number does not have to be transferred to RAM and stripped down to 8 bytes we can get a really nice precision.
Testing something like this on different processors (AMD, Intel), languages (C, C++, C#, Java) or compiler optimization levels can give results can be around 1e-16, 1e-20, or even 1e-320
Take a look at CIL / assembler / jasmin code to see exactly what is going on (eg: for C++ g++ -S test.cpp
creates test.s
file with assembler code in it)
(float)Math.Pow(2,24) == 16777217
Go ahead and try it!Math.Pow(2,53) + 1 == Math.Pow(2,53)
and so on.