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.
This commit is contained in:
Trevor Gross
2025-01-12 04:24:03 +00:00
committed by Trevor Gross
parent 5b1c1fca03
commit 228c716a43

View File

@@ -114,7 +114,6 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
Id::Exp10 | Id::Exp10f => ulp = 1_000_000,
Id::Exp2 | Id::Exp2f => ulp = 10_000_000,
Id::Log1p | Id::Log1pf => ulp = 2,
Id::Rint => ulp = 100_000,
Id::Round => ulp = 1,
Id::Tan => ulp = 2,
_ => (),
@@ -261,6 +260,15 @@ impl MaybeOverride<(f64,)> for SpecialCase {
}
}
if cfg!(x86_no_sse)
&& ctx.base_name == BaseName::Rint
&& (expected - actual).abs() <= F::ONE
&& (expected - actual).abs() > F::ZERO
{
// Our rounding mode is incorrect.
return XFAIL;
}
if ctx.base_name == BaseName::Acosh && input.0 < 1.0 {
// The function is undefined for the inputs, musl and our libm both return
// random results.