Message342625
It sounds like you need to read an introduction (any!) to computer floating-point formats. The relevant part in the output you showed is this:
mant_dig=53
As on almost other current machines, your platform's floating point format is restricted to 53 bits of precision. Therefore it's impossible to convert any positive integer to float without losing bits if the integer is of the form I * 2**E where I is odd and I.bit_length() > 53.
That doesn't mean integers you can convert faithfully must be "small". For example 2**200 can be converted to float exactly. Apart from the power-of-2-exponent, that has only 1 significant bit. You can also convert (2**52 + 1) * 2**200 to float exactly. But NOT (2**53 + 1) * 2**200, because that requires 54 significant bits. |
|
Date |
User |
Action |
Args |
2019-05-16 04:21:47 | tim.peters | set | recipients:
+ tim.peters, sajjadfx |
2019-05-16 04:21:47 | tim.peters | set | messageid: <1557980507.49.0.876510548013.issue36934@roundup.psfhosted.org> |
2019-05-16 04:21:47 | tim.peters | link | issue36934 messages |
2019-05-16 04:21:47 | tim.peters | create | |
|