diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2008-04-20 04:13:13 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2008-04-20 04:13:13 (GMT) |
commit | cec3f138d8cd6c5e3fd78200119a94d59440cfad (patch) | |
tree | cc9fe90ef4028a2028bc288611f285a18c07f140 /Lib/test/test_math.py | |
parent | b2f70902395a56fce14f47b685eb4966ec09257e (diff) | |
download | cpython-cec3f138d8cd6c5e3fd78200119a94d59440cfad.zip cpython-cec3f138d8cd6c5e3fd78200119a94d59440cfad.tar.gz cpython-cec3f138d8cd6c5e3fd78200119a94d59440cfad.tar.bz2 |
Yet more explicit special case handling to make
math.pow behave on alpha Tru64. All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r-- | Lib/test/test_math.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 4a54a6e..7d6ce4a 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -498,6 +498,18 @@ class MathTests(unittest.TestCase): self.assertEqual(math.pow(-1.1, INF), INF) self.assertEqual(math.pow(-1.9, INF), INF) + # pow(x, y) should work for x negative, y an integer + self.ftest('(-2.)**3.', math.pow(-2.0, 3.0), -8.0) + self.ftest('(-2.)**2.', math.pow(-2.0, 2.0), 4.0) + self.ftest('(-2.)**1.', math.pow(-2.0, 1.0), -2.0) + self.ftest('(-2.)**0.', math.pow(-2.0, 0.0), 1.0) + self.ftest('(-2.)**-0.', math.pow(-2.0, -0.0), 1.0) + self.ftest('(-2.)**-1.', math.pow(-2.0, -1.0), -0.5) + self.ftest('(-2.)**-2.', math.pow(-2.0, -2.0), 0.25) + self.ftest('(-2.)**-3.', math.pow(-2.0, -3.0), -0.125) + self.assertRaises(ValueError, math.pow, -2.0, -0.5) + self.assertRaises(ValueError, math.pow, -2.0, 0.5) + # the following tests have been commented out since they don't # really belong here: the implementation of ** for floats is # independent of the implemention of math.pow |