Message409143
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? |
|
Date |
User |
Action |
Args |
2021-12-24 13:17:25 | cykerway | set | recipients:
+ cykerway |
2021-12-24 13:17:25 | cykerway | set | messageid: <1640351845.8.0.430184776211.issue46173@roundup.psfhosted.org> |
2021-12-24 13:17:25 | cykerway | link | issue46173 messages |
2021-12-24 13:17:25 | cykerway | create | |
|