There was an error while loading. Please reload this page.
1 parent 525ff49 commit babebf0Copy full SHA for babebf0
2 files changed
Lib/test/test_math.py
@@ -260,8 +260,6 @@ def testAcos(self):
260
self.assertRaises(ValueError, math.acos, -1 - eps)
261
self.assertTrue(math.isnan(math.acos(NAN)))
262
263
- # TODO: RUSTPYTHON
264
- @unittest.expectedFailure
265
def testAcosh(self):
266
self.assertRaises(TypeError, math.acosh)
267
self.ftest('acosh(1)', math.acosh(1), 0)
vm/src/stdlib/math.rs
@@ -225,7 +225,15 @@ fn math_radians(x: IntoPyFloat) -> f64 {
225
}
226
227
// Hyperbolic functions:
228
-make_math_func!(math_acosh, acosh);
+fn math_acosh(x: IntoPyFloat, vm: &VirtualMachine) -> PyResult<f64> {
229
+ let x = x.to_f64();
230
+ if x.is_sign_negative() || x.is_zero() {
231
+ Err(vm.new_value_error("math domain error".to_owned()))
232
+ } else {
233
+ Ok(x.acosh())
234
+ }
235
+}
236
+
237
make_math_func!(math_asinh, asinh);
238
make_math_func!(math_atanh, atanh);
239
make_math_func!(math_cosh, cosh);
0 commit comments