Increase the precision for jn and jnf

New random seeds seem to indicate that this test does have some more
failures, this is a recent failure on i586:

    ---- musl_random_jnf stdout ----
    Random Musl jnf arg 1/2: 100 iterations (10000 total) using `LIBM_SEED=nLfzQ3U1OBVvqWaMBcto84UTMsC5FIaC`
    Random Musl jnf arg 2/2: 100 iterations (10000 total) using `LIBM_SEED=nLfzQ3U1OBVvqWaMBcto84UTMsC5FIaC`

    thread 'musl_random_jnf' panicked at crates/libm-test/tests/compare_built_musl.rs:43:51:
    called `Result::unwrap()` on an `Err` value:
        input:    (205, 5497.891) (0x000000cd, 0x45abcf21)
        expected: 7.3291517e-6           0x36f5ecef
        actual:   7.331668e-6            0x36f6028c

    Caused by:
        ulp 5533 > 4000

It seems unlikely that `jn` would somehow have better precision than
`j0`/`j1`, so just use the same precision.
This commit is contained in:
Trevor Gross
2025-01-06 03:00:54 +00:00
committed by Trevor Gross
parent ea21b6045f
commit 206bf326d5

View File

@@ -47,8 +47,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
Bn::Tgamma if ctx.fn_ident != Id::Tgamma => 0,
// Bessel functions have large inaccuracies.
Bn::J0 | Bn::J1 | Bn::Y0 | Bn::Y1 => 8_000_000,
Bn::Jn | Bn::Yn => 1_000,
Bn::J0 | Bn::J1 | Bn::Y0 | Bn::Y1 | Bn::Jn | Bn::Yn => 8_000_000,
// For all other operations, specify our implementation's worst case precision.
Bn::Acos => 1,
@@ -96,7 +95,6 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
match ctx.fn_ident {
// FIXME(#401): musl has an incorrect result here.
Id::Fdim => ulp = 2,
Id::Jnf | Id::Ynf => ulp = 4000,
Id::Sincosf => ulp = 500,
Id::Tgamma => ulp = 20,
_ => (),