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.
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 @@
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