Issue #23185: add math.inf and math.nan constants.

This commit is contained in:
Mark Dickinson 2015-01-11 11:55:29 +00:00
parent 845b14cc8e
commit a5d0c7c2fd
5 changed files with 69 additions and 1 deletions

View file

@ -983,6 +983,17 @@ def testIsinf(self):
self.assertFalse(math.isinf(0.))
self.assertFalse(math.isinf(1.))
@requires_IEEE_754
def test_nan_constant(self):
self.assertTrue(math.isnan(math.nan))
@requires_IEEE_754
def test_inf_constant(self):
self.assertTrue(math.isinf(math.inf))
self.assertGreater(math.inf, 0.0)
self.assertEqual(math.inf, float("inf"))
self.assertEqual(-math.inf, float("-inf"))
# RED_FLAG 16-Oct-2000 Tim
# While 2.0 is more consistent about exceptions than previous releases, it
# still fails this part of the test on some platforms. For now, we only