Skip to content

Commit e2ff35e

Browse files
committed
exp10: Add cr_exp10 from CORE-MATH
This was our function with the worst precision. Replace our current implementation with the CORE-MATH correctly rounded version. Source: https://gitlab.inria.fr/core-math/core-math/-/blob/93d9f3bab7561cfb62f746f7e70c0888bb5c9a00/src/binary64/exp10/exp10.c
1 parent 18673f2 commit e2ff35e

6 files changed

Lines changed: 942 additions & 12 deletions

File tree

libm-test/src/f8_impl.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ impl Float for f8 {
9090
libm::generic::copysign(self, other)
9191
}
9292

93+
fn roundeven(self) -> Self {
94+
libm::generic::rint_status(self).val
95+
}
96+
9397
fn fma(self, _y: Self, _z: Self) -> Self {
9498
unimplemented!()
9599
}

libm-test/src/precision.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ pub fn default_ulp(ctx: &CheckCtx) -> Option<u32> {
9292
Bn::Erf => 1,
9393
Bn::Erfc => 4,
9494
Bn::Exp => 1,
95-
Bn::Exp10 => 6,
95+
Bn::Exp10 if ctx.fn_ident == Id::Exp10f => 6,
96+
Bn::Exp10 => 0,
9697
Bn::Exp2 => 1,
9798
Bn::Expm1 => 1,
9899
Bn::Hypot => 1,

libm/src/math/approx/exp10f64.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ const P10: &[f64] = &[
99
/// Calculates 10 raised to the power of `x` (f64).
1010
#[cfg_attr(assert_no_panic, no_panic::no_panic)]
1111
pub fn exp10f64(x: f64) -> f64 {
12-
select_implementation! {
13-
name: x87_exp10,
14-
use_arch_required: x86_no_sse2,
15-
args: x,
16-
}
17-
1812
let (mut y, n) = modf(x);
1913
let u: u64 = n.to_bits();
2014
/* fabs(n) < 16 without raising invalid on nan */

0 commit comments

Comments
 (0)