mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
[3.6] bpo-31373: remove overly strict float range checks (GH-3486) (#3495)
This undoesa853a8ba78
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. (cherry picked from commit2bb69a5b4e
)
This commit is contained in:
parent
99b941b420
commit
cb356c2ecc
4 changed files with 14 additions and 6 deletions
|
@ -613,6 +613,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue