Increase numerical precision of log1p

Use Rust native ln_1p to increase numerical precision matching what is
expected by `test_mtestfile`.
This commit is contained in:
Karel Král
2025-04-29 22:07:39 +02:00
committed by Jeong, YunWon
parent cd1c9be0e1
commit 301c32dba0

View File

@@ -147,7 +147,7 @@ mod math {
fn log1p(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> {
let x = *x;
if x.is_nan() || x > -1.0_f64 {
Ok((x + 1.0_f64).ln())
Ok(x.ln_1p())
} else {
Err(vm.new_value_error("math domain error".to_owned()))
}