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

Commit a04c94e

Browse files
committed
Update precision based on failures from extensive tests
1 parent db76a54 commit a04c94e

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

crates/libm-test/src/precision.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
2626
// Overrides that apply to either basis
2727
// FMA is expected to be infinite precision.
2828
(_, Id::Fma | Id::Fmaf) => 0,
29-
(_, Id::J0 | Id::J0f | Id::J1 | Id::J1f) => 800_000,
29+
(_, Id::J0 | Id::J0f | Id::J1 | Id::J1f) => 8_000_000,
3030
(_, Id::Jn | Id::Jnf) => 1000,
3131

3232
// Overrides for musl
@@ -44,6 +44,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
4444
(Mpfr, Id::Acoshf) => 4,
4545
(Mpfr, Id::Asinh | Id::Asinhf) => 2,
4646
(Mpfr, Id::Atanh | Id::Atanhf) => 2,
47+
(Mpfr, Id::Atan2 | Id::Atan2f) => 2,
4748
(Mpfr, Id::Exp10 | Id::Exp10f) => 6,
4849
(Mpfr, Id::Lgamma | Id::LgammaR | Id::Lgammaf | Id::LgammafR) => 16,
4950
(Mpfr, Id::Sinh | Id::Sinhf) => 2,
@@ -127,6 +128,20 @@ impl MaybeOverride<(f32,)> for SpecialCase {
127128
return XFAIL;
128129
}
129130

131+
if (ctx.base_name == BaseName::Lgamma || ctx.base_name == BaseName::LgammaR)
132+
&& input.0 > 4e36
133+
&& expected.is_infinite()
134+
&& !actual.is_infinite()
135+
{
136+
// This result should saturate but we return a finite value.
137+
return XFAIL;
138+
}
139+
140+
if ctx.base_name == BaseName::J0 && input.0 < -1e34 {
141+
// Errors get huge close to -inf
142+
return XFAIL;
143+
}
144+
130145
maybe_check_nan_bits(actual, expected, ctx)
131146
}
132147

@@ -188,6 +203,11 @@ impl MaybeOverride<(f64,)> for SpecialCase {
188203
return XFAIL;
189204
}
190205

206+
if ctx.base_name == BaseName::J0 && input.0 < -1e300 {
207+
// Errors get huge close to -inf
208+
return XFAIL;
209+
}
210+
191211
maybe_check_nan_bits(actual, expected, ctx)
192212
}
193213

@@ -304,6 +324,7 @@ impl MaybeOverride<(i32, f32)> for SpecialCase {
304324
}
305325
}
306326
}
327+
307328
impl MaybeOverride<(i32, f64)> for SpecialCase {
308329
fn check_float<F: Float>(
309330
input: (i32, f64),

0 commit comments

Comments
 (0)