This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients sajjadfx, tim.peters
Date 2019-05-16.04:21:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557980507.49.0.876510548013.issue36934@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2019-05-16 04:21:47tim.peterssetrecipients: + tim.peters, sajjadfx
2019-05-16 04:21:47tim.peterssetmessageid: <1557980507.49.0.876510548013.issue36934@roundup.psfhosted.org>
2019-05-16 04:21:47tim.peterslinkissue36934 messages
2019-05-16 04:21:47tim.peterscreate