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 cykerway
Recipients cykerway
Date 2021-12-24.13:17:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1640351845.8.0.430184776211.issue46173@roundup.psfhosted.org>
In-reply-to
Content
Acccording to: https://docs.python.org/3/library/functions.html#float

>    If the argument is outside the range of a Python float, an OverflowError will be raised.

It is well known that the maximum value in IEEE 754 binary64 format is:

    >>> M = ((1<<53)-1)<<(1023-52)
    ...

So `(M+1)` will be out of range. But `float(M+1)` gives me:

    >>> float(M+1)
    1.7976931348623157e+308

No OverflowError is thrown. Contrast this with:

    >>> float(M+M)
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    OverflowError: int too large to convert to float

In another text: https://docs.python.org/3/tutorial/floatingpoint.html#representation-error

>   ...Almost all machines today (November 2000) use IEEE-754 floating point arithmetic, and almost all platforms map Python floats to IEEE-754 “double precision”...

Is Python not following IEEE 754 binary64 format or something missing here?
History
Date User Action Args
2021-12-24 13:17:25cykerwaysetrecipients: + cykerway
2021-12-24 13:17:25cykerwaysetmessageid: <1640351845.8.0.430184776211.issue46173@roundup.psfhosted.org>
2021-12-24 13:17:25cykerwaylinkissue46173 messages
2021-12-24 13:17:25cykerwaycreate