Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Lib/test/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ def testAcos(self):
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)
Expand Down
10 changes: 9 additions & 1 deletion vm/src/stdlib/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down