summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-04-19 00:31:39 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-04-19 00:31:39 (GMT)
commit53876d9cd8a67d9e67772e082deab92a598f74b3 (patch)
tree2d605900cab56cbfe55c6ca6e41f1a0c0cb6f91b /Lib/test/test_float.py
parentdc3e06ce3a24882a6b68ec19544910095770111e (diff)
downloadcpython-53876d9cd8a67d9e67772e082deab92a598f74b3.zip
cpython-53876d9cd8a67d9e67772e082deab92a598f74b3.tar.gz
cpython-53876d9cd8a67d9e67772e082deab92a598f74b3.tar.bz2
Merged revisions 62380,62382-62383 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r62380 | christian.heimes | 2008-04-19 01:13:07 +0200 (Sat, 19 Apr 2008) | 3 lines I finally got the time to update and merge Mark's and my trunk-math branch. The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math. The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :) ........ r62382 | christian.heimes | 2008-04-19 01:40:40 +0200 (Sat, 19 Apr 2008) | 2 lines Added new files to Windows project files More Windows related fixes are coming soon ........ r62383 | christian.heimes | 2008-04-19 01:49:11 +0200 (Sat, 19 Apr 2008) | 1 line Stupid me. Py_RETURN_NAN should actually return something ... ........
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r--Lib/test/test_float.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index b9ad8c5..e89d723 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -2,12 +2,12 @@
import unittest, struct
import os
from test import test_support
+import math
+from math import isinf, isnan
+import operator
-def isinf(x):
- return x * 0.5 == x
-
-def isnan(x):
- return x != x
+INF = float("inf")
+NAN = float("nan")
class FormatFunctionsTestCase(unittest.TestCase):
@@ -239,6 +239,17 @@ class InfNanTest(unittest.TestCase):
self.assertEqual(str(1e300 * 1e300 * 0), "nan")
self.assertEqual(str(-1e300 * 1e300 * 0), "nan")
+ def notest_float_nan(self):
+ self.assert_(NAN.is_nan())
+ self.failIf(INF.is_nan())
+ self.failIf((0.).is_nan())
+
+ def notest_float_inf(self):
+ self.assert_(INF.is_inf())
+ self.failIf(NAN.is_inf())
+ self.failIf((0.).is_inf())
+
+
def test_main():
test_support.run_unittest(
FormatFunctionsTestCase,