mirror of
https://github.com/python/cpython.git
synced 2025-07-31 07:04:42 +00:00
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 :)
This commit is contained in:
parent
858a77099e
commit
6f34109384
25 changed files with 5101 additions and 1158 deletions
|
@ -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):
|
||||
|
||||
|
@ -206,6 +206,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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue