Merge pull request #4152 from jopemachine/fix-math-pow

Fix edge case of `math.pow(0.0, -inf)`, `math.pow(-0.0, -inf)`
This commit is contained in:
Jeong YunWon
2022-09-12 13:54:51 +09:00
committed by GitHub
2 changed files with 1 additions and 3 deletions

View File

@@ -1227,8 +1227,6 @@ class MathTests(unittest.TestCase):
self.assertTrue(math.isnan(modf_nan[0]))
self.assertTrue(math.isnan(modf_nan[1]))
# TODO: RUSTPYTHON
@unittest.expectedFailure
def testPow(self):
self.assertRaises(TypeError, math.pow)
self.ftest('pow(0,1)', math.pow(0,1), 0)

View File

@@ -184,7 +184,7 @@ mod math {
return Err(vm.new_value_error("math domain error".to_owned()));
}
if x == 0.0 && y < 0.0 {
if x == 0.0 && y < 0.0 && y != f64::NEG_INFINITY {
return Err(vm.new_value_error("math domain error".to_owned()));
}