Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit d56c3aa

Browse files
committed
Add a new precision adjustment for i586 rint
`rint` had a couple recent failures from the random tests: ---- mp_random_rint stdout ---- Random Mpfr rint arg 1/1: 10000 iterations (10000 total) using `LIBM_SEED=Fl1f69DaJnwkHN2FeuCXaBFRvJYsPvEY` thread 'mp_random_rint' panicked at crates/libm-test/tests/multiprecision.rs:41:49: called `Result::unwrap()` on an `Err` value: input: (-849751480.5001163,) (0xc1c95316dc4003d0,) expected: -849751481.0 0xc1c95316dc800000 actual: -849751480.0 0xc1c95316dc000000 Caused by: ulp 8388608 > 100000 And: ---- mp_random_rint stdout ---- Random Mpfr rint arg 1/1: 10000 iterations (10000 total) using `LIBM_SEED=XN7VCGhX3Wu6Mzn8COvJPITyZlGP7gN7` thread 'mp_random_rint' panicked at crates/libm-test/tests/multiprecision.rs:41:49: called `Result::unwrap()` on an `Err` value: input: (-12493089.499809155,) (0xc167d4242ffe6fc5,) expected: -12493089.0 0xc167d42420000000 actual: -12493090.0 0xc167d42440000000 Caused by: ulp 536870912 > 100000 It seems we just implement an incorrect rounding mode. Replace the existing `rint` override with an xfail if the difference is 0.0 <= ε <= 1.0.
1 parent 5eda282 commit d56c3aa

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

crates/libm-test/src/precision.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
114114
Id::Exp10 | Id::Exp10f => ulp = 1_000_000,
115115
Id::Exp2 | Id::Exp2f => ulp = 10_000_000,
116116
Id::Log1p | Id::Log1pf => ulp = 2,
117-
Id::Rint => ulp = 100_000,
118117
Id::Round => ulp = 1,
119118
Id::Tan => ulp = 2,
120119
_ => (),
@@ -261,6 +260,15 @@ impl MaybeOverride<(f64,)> for SpecialCase {
261260
}
262261
}
263262

263+
if cfg!(x86_no_sse)
264+
&& ctx.base_name == BaseName::Rint
265+
&& (expected - actual).abs() <= F::ONE
266+
&& (expected - actual).abs() > F::ZERO
267+
{
268+
// Our rounding mode is incorrect.
269+
return XFAIL;
270+
}
271+
264272
if ctx.base_name == BaseName::Acosh && input.0 < 1.0 {
265273
// The function is undefined for the inputs, musl and our libm both return
266274
// random results.

0 commit comments

Comments
 (0)