diff options
author | Sebastian Berg <sebastianb@nvidia.com> | 2023-05-10 16:44:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-10 16:44:52 (GMT) |
commit | 7a3b03509e5e3e72d8c47137579cccb52548a318 (patch) | |
tree | cbb1adddb46665552cb1e93ccae135aac0507e80 /Lib/test/test_math.py | |
parent | a7a2dbbf72aceef61bfb50901bfa39bfb8d6d229 (diff) | |
download | cpython-7a3b03509e5e3e72d8c47137579cccb52548a318.zip cpython-7a3b03509e5e3e72d8c47137579cccb52548a318.tar.gz cpython-7a3b03509e5e3e72d8c47137579cccb52548a318.tar.bz2 |
gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202)
This PR removes `_Py_dg_stdnan` and `_Py_dg_infinity` in favour of
using the standard `NAN` and `INFINITY` macros provided by C99.
This change has the side-effect of fixing a bug on MIPS where the
hard-coded value used by `_Py_dg_stdnan` gave a signalling NaN
rather than a quiet NaN.
---------
Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r-- | Lib/test/test_math.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 433161c..f282434 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -1881,11 +1881,11 @@ class MathTests(unittest.TestCase): self.assertFalse(math.isinf(0.)) self.assertFalse(math.isinf(1.)) - @requires_IEEE_754 def test_nan_constant(self): + # `math.nan` must be a quiet NaN with positive sign bit self.assertTrue(math.isnan(math.nan)) + self.assertEqual(math.copysign(1., math.nan), 1.) - @requires_IEEE_754 def test_inf_constant(self): self.assertTrue(math.isinf(math.inf)) self.assertGreater(math.inf, 0.0) |