Mark Dickinson added the comment: 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) b'\xff\xff\x7f\x7f' 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31373> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com