mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
2 files changed
+9
-3
No files matched your search
@@ -260,8 +260,6 @@ class MathTests(unittest.TestCase):
|
||||
self.assertRaises(ValueError, math.acos, -1 - eps)
|
||||
self.assertTrue(math.isnan(math.acos(NAN)))
|
||||
|
||||
# TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure
|
||||
def testAcosh(self):
|
||||
self.assertRaises(TypeError, math.acosh)
|
||||
self.ftest('acosh(1)', math.acosh(1), 0)
|
||||
|
||||
@@ -225,7 +225,15 @@ fn math_radians(x: IntoPyFloat) -> f64 {
|
||||
}
|
||||
|
||||
// Hyperbolic functions:
|
||||
make_math_func!(math_acosh, acosh);
|
||||
fn math_acosh(x: IntoPyFloat, vm: &VirtualMachine) -> PyResult<f64> {
|
||||
let x = x.to_f64();
|
||||
if x.is_sign_negative() || x.is_zero() {
|
||||
Err(vm.new_value_error("math domain error".to_owned()))
|
||||
} else {
|
||||
Ok(x.acosh())
|
||||
}
|
||||
}
|
||||
|
||||
make_math_func!(math_asinh, asinh);
|
||||
make_math_func!(math_atanh, atanh);
|
||||
make_math_func!(math_cosh, cosh);
|
||||
|
||||
Reference in new issue
Block a user