Author mark.dickinson
Recipients benjamin.peterson, mark.dickinson, vstinner
Date 2017-09-10.04:43:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
There's a (to my mind) unfortunate change in behaviour here. Under normal IEEE 754 rules, some C double values larger than FLT_MAX still round to FLT_MAX under conversion to float.

Python 3.6:

>>> import struct
>>> x = 3.40282356e38
>>> struct.pack("<f", x)

Following the changes in this PR:

>>> import struct
>>> x = 3.40282356e38
>>> struct.pack("<f", x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: float too large to pack with f format

The original behaviour is correct with respect to IEEE 754; the new behaviour is not. I think this is a case where the cure is worse than the disease.
Date User Action Args
2017-09-10 04:43:53mark.dickinsonsetrecipients: + mark.dickinson, vstinner, benjamin.peterson
2017-09-10 04:43:53mark.dickinsonsetmessageid: <>
2017-09-10 04:43:53mark.dickinsonlinkissue31373 messages
2017-09-10 04:43:52mark.dickinsoncreate