diff options
author | Benjamin Peterson <benjamin@python.org> | 2017-09-10 23:50:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-10 23:50:46 -0700 |
commit | 2bb69a5b4e7f96cb35d1b28aa7b7b3974b351f59 (patch) | |
tree | b7f672d07435aff1060d27f20867365e637b8df9 /Lib/test/test_float.py | |
parent | 252033d50effa08046ac34fcc406bc99796ab88b (diff) | |
download | cpython-git-2bb69a5b4e7f96cb35d1b28aa7b7b3974b351f59.tar.gz |
bpo-31373: remove overly strict float range checks (#3486)
This undoes a853a8ba7850381d49b284295dd6f0dc491dbe44 except for the pytime.c
parts. We want to continue to allow IEEE 754 doubles larger than FLT_MAX to be
rounded into finite floats. Tests were added to very this behavior.
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 66726d6496..a16c05cf5d 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -617,6 +617,12 @@ class IEEEFormatTestCase(unittest.TestCase): ('<f', LE_FLOAT_NAN)]: struct.unpack(fmt, data) + @support.requires_IEEE_754 + def test_serialized_float_rounding(self): + from _testcapi import FLT_MAX + self.assertEqual(struct.pack("<f", 3.40282356e38), struct.pack("<f", FLT_MAX)) + self.assertEqual(struct.pack("<f", -3.40282356e38), struct.pack("<f", -FLT_MAX)) + class FormatTestCase(unittest.TestCase): def test_format(self): |