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

Commit 589f502

Browse files
committed
Update precision based on failures from extensive tests
1 parent 98b43f1 commit 589f502

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 | Id::Y0 | Id::Y0f | Id::Y1 | Id::Y1f) => 800_000,
29+
(_, Id::J0 | Id::J0f | Id::J1 | Id::J1f | Id::Y0 | Id::Y0f | Id::Y1 | Id::Y1f) => 8_000_000,
3030
(_, Id::Jn | Id::Jnf | Id::Yn | Id::Ynf) => 1000,
3131
(_, Id::Erfc | Id::Erfcf) => 4,
3232

@@ -45,6 +45,7 @@ pub fn default_ulp(ctx: &CheckCtx) -> u32 {
4545
(Mpfr, Id::Acoshf) => 4,
4646
(Mpfr, Id::Asinh | Id::Asinhf) => 2,
4747
(Mpfr, Id::Atanh | Id::Atanhf) => 2,
48+
(Mpfr, Id::Atan2 | Id::Atan2f) => 2,
4849
(Mpfr, Id::Exp10 | Id::Exp10f) => 6,
4950
(Mpfr, Id::Lgamma | Id::LgammaR | Id::Lgammaf | Id::LgammafR) => 16,
5051
(Mpfr, Id::Sinh | Id::Sinhf) => 2,
@@ -128,6 +129,20 @@ impl MaybeOverride<(f32,)> for SpecialCase {
128129
return XFAIL;
129130
}
130131

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

@@ -189,6 +204,11 @@ impl MaybeOverride<(f64,)> for SpecialCase {
189204
return XFAIL;
190205
}
191206

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

@@ -305,6 +325,7 @@ impl MaybeOverride<(i32, f32)> for SpecialCase {
305325
}
306326
}
307327
}
328+
308329
impl MaybeOverride<(i32, f64)> for SpecialCase {
309330
fn check_float<F: Float>(
310331
input: (i32, f64),

0 commit comments

Comments
 (0)