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 steven.daprano
Recipients cykerway, mark.dickinson, steven.daprano
Date 2021-12-24.14:08:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640354917.54.0.0252327554058.issue46173@roundup.psfhosted.org>
In-reply-to
Content
float(x) performs rounding. Only if the value after rounding is out of range is OverflowError raised.

M + 1, when correctly rounded to the nearest even float, gives sys.float_info.max. Likewise for M+2, M+3 etc all the way to M+K where K equals 2**960 before the correctly rounded result of float(M+K) overflows.

Anything less than K=2**960 is too small to be distinguished from M when added to it. So there's no bug here, the behaviour is correct for IEEE-754, although perhaps the documentation is misleading.

Mark, is my explanation right?
History
Date User Action Args
2021-12-24 14:08:37steven.dapranosetrecipients: + steven.daprano, mark.dickinson, cykerway
2021-12-24 14:08:37steven.dapranosetmessageid: <1640354917.54.0.0252327554058.issue46173@roundup.psfhosted.org>
2021-12-24 14:08:37steven.dapranolinkissue46173 messages
2021-12-24 14:08:37steven.dapranocreate