From 96fc308c043e6534b198e9b702726ba819f34b81 Mon Sep 17 00:00:00 2001 From: Gyubong Date: Fri, 9 Sep 2022 09:30:07 +0900 Subject: [PATCH] Add `math.cbrt` Update math.rs --- Lib/test/test_math.py | 2 -- stdlib/src/math.rs | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py index 456695ecef8..98185c30064 100644 --- a/Lib/test/test_math.py +++ b/Lib/test/test_math.py @@ -377,8 +377,6 @@ def testAtan2(self): self.assertTrue(math.isnan(math.atan2(NAN, INF))) self.assertTrue(math.isnan(math.atan2(NAN, NAN))) - # TODO: RUSTPYTHON - @unittest.expectedFailure def testCbrt(self): self.assertRaises(TypeError, math.cbrt) self.ftest('cbrt(0)', math.cbrt(0), 0) diff --git a/stdlib/src/math.rs b/stdlib/src/math.rs index 6ceb0e4917a..91ae0b57c70 100644 --- a/stdlib/src/math.rs +++ b/stdlib/src/math.rs @@ -541,6 +541,11 @@ mod math { math_perf_arb_len_int_op(args, |x, y| x.lcm(y.as_bigint()), BigInt::one()) } + #[pyfunction] + fn cbrt(x: ArgIntoFloat) -> f64 { + x.cbrt() + } + #[pyfunction] fn fsum(seq: ArgIterable, vm: &VirtualMachine) -> PyResult { let mut partials = vec![];