Skip to content

Commit 301c32d

Browse files
Karel Krályouknowone
Karel Král
authored andcommitted
Increase numerical precision of log1p
Use Rust native ln_1p to increase numerical precision matching what is expected by `test_mtestfile`.
1 parent cd1c9be commit 301c32d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/src/math.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ mod math {
147147
fn log1p(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> {
148148
let x = *x;
149149
if x.is_nan() || x > -1.0_f64 {
150-
Ok((x + 1.0_f64).ln())
150+
Ok(x.ln_1p())
151151
} else {
152152
Err(vm.new_value_error("math domain error".to_owned()))
153153
}

0 commit comments

Comments
 (0)