When converting sys.maxint to float or double, the result is exactly 0x1p63, because the value contains only 24 or 53 bits (including the implicit bit), so the final bits cause rounding. (sys.maxint 2 ^ 63 - 1, and rounding is 2 ^ 63.)
Then, when you print this float, some routine formats it as a decimal digit. To do this, he calculates the numbers to represent 2 ^ 63. The fact that he is able to print 9.2233720368547758e + 18 does not mean that the original number contains bits that distinguish it from 9.2233720368547759e + 18. It just means that the bits in it represent itself 9.2233720368547758e + 18 (approximately). In fact, the next representable double-precision floating-point number is 9223372036854777856 (approximately 9.2233720368547778e + 18), which is 2 ^ 63 + 2048. Thus, the low 11 bits of these integers are not present in the double. The formatter simply displays the number as if these bits were zero.
Eric Postpischil
source share