mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Added math.isinf() and math.isnan()
This commit is contained in:
parent
ae04c3356e
commit
e2ca4245c9
4 changed files with 69 additions and 6 deletions
|
|
@ -229,6 +229,22 @@ class MathTests(unittest.TestCase):
|
|||
self.ftest('tanh(0)', math.tanh(0), 0)
|
||||
self.ftest('tanh(1)+tanh(-1)', math.tanh(1)+math.tanh(-1), 0)
|
||||
|
||||
def testIsnan(self):
|
||||
self.assert_(math.isnan(float("nan")))
|
||||
self.assert_(math.isnan(float("inf")* 0.))
|
||||
self.failIf(math.isnan(float("inf")))
|
||||
self.failIf(math.isnan(0.))
|
||||
self.failIf(math.isnan(1.))
|
||||
|
||||
def testIsinf(self):
|
||||
self.assert_(math.isinf(float("inf")))
|
||||
self.assert_(math.isinf(float("-inf")))
|
||||
self.assert_(math.isinf(1E400))
|
||||
self.assert_(math.isinf(-1E400))
|
||||
self.failIf(math.isinf(float("nan")))
|
||||
self.failIf(math.isinf(0.))
|
||||
self.failIf(math.isinf(1.))
|
||||
|
||||
# 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue