From e0f491ea8cd35c23152e368fc5247099f9752923 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Mon, 12 Sep 2022 12:45:56 +0900 Subject: [PATCH] Fix edge case of `math.pow(0.0, -inf)`, `math.pow(-0.0, -inf)` --- Lib/test/test_math.py | 2 -- stdlib/src/math.rs | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 456695ece..582e77f74 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -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) diff --git a/stdlib/src/math.rs b/stdlib/src/math.rs index 6ceb0e491..9d7ce701d 100644 --- a/stdlib/src/math.rs +++ b/stdlib/src/math.rs @@ -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())); }