diff --git a/src/math/acosh.c b/src/math/acosh.c index a1cc1d9..1a468a9 100644 --- a/src/math/acosh.c +++ b/src/math/acosh.c @@ -34,11 +34,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { - // only report at most one <2ulp error - if (fabsf(d) < 2 && err) continue; + if (fabsf(d) < 2.0f) + printf("X "); + else + err++; printf("%s:%d: %s acosh(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/asinh.c b/src/math/asinh.c index 0d28fff..b37b0be 100644 --- a/src/math/asinh.c +++ b/src/math/asinh.c @@ -34,11 +34,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { - // only report at most one <2ulp error - if (fabsf(d) < 2 && err) continue; + if (fabsf(d) < 2.0f) + printf("X "); + else + err++; printf("%s:%d: %s asinh(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/cos.c b/src/math/cos.c index b2f5de2..1e608a5 100644 --- a/src/math/cos.c +++ b/src/math/cos.c @@ -36,9 +36,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (p->r != RN) + printf("X "); + else + err++; printf("%s:%d: %s cos(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/erf.c b/src/math/erf.c index 655e564..efff5f4 100644 --- a/src/math/erf.c +++ b/src/math/erf.c @@ -34,9 +34,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabs(d) < 4.0f) + printf("X "); + else + err++; printf("%s:%d: %s erf(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/erfc.c b/src/math/erfc.c index 799f79f..4a4a489 100644 --- a/src/math/erfc.c +++ b/src/math/erfc.c @@ -34,9 +34,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabs(d) < 4.0f) + printf("X "); + else + err++; printf("%s:%d: %s erfc(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/exp2.c b/src/math/exp2.c index f98a995..612b7bb 100644 --- a/src/math/exp2.c +++ b/src/math/exp2.c @@ -27,10 +27,13 @@ int main(void) e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); if (!checkexcept(e, p->e, p->r)) { + if (fabs(y) < 0x1p-1022 && (e|INEXACT) == (INEXACT|UNDERFLOW)) + printf("X "); + else + err++; printf("%s:%d: bad fp exception: %s exp2(%a)=%a, want %s", p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e)); printf(" got %s\n", estr(e)); - err++; } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { diff --git a/src/math/expm1l.c b/src/math/expm1l.c index c365d9f..d3d3de0 100644 --- a/src/math/expm1l.c +++ b/src/math/expm1l.c @@ -41,9 +41,12 @@ int main(void) } d = ulperrl(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabsf(d) < 2.5f) + printf("X "); + else + err++; printf("%s:%d: %s expm1l(%La) want %La got %La ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/j0.c b/src/math/j0.c index b893c00..029a8a7 100644 --- a/src/math/j0.c +++ b/src/math/j0.c @@ -14,7 +14,7 @@ int main(void) #pragma STDC FENV_ACCESS ON double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct d_d *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -35,12 +35,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { -// printf("%s:%d: %s j0(%a) want %a got %a ulperr %.3f = %a + %a\n", -// p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; - // TODO: avoid spamming the output - printf(__FILE__ ": known to be broken near zeros\n"); - break; + if (fabsf(d) < 0x1p52f) + printf("X "); + else + err++; + printf("%s:%d: %s j0(%a) want %a got %a ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); } } return !!err; diff --git a/src/math/j0f.c b/src/math/j0f.c index 1c06ec8..a0517dc 100644 --- a/src/math/j0f.c +++ b/src/math/j0f.c @@ -36,12 +36,12 @@ int main(void) } d = ulperrf(y, p->y, p->dy); if (!checkulp(d, p->r)) { -// printf("%s:%d: %s j0f(%a) want %a got %a ulperr %.3f = %a + %a\n", -// p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; - // TODO: avoid spamming the output - printf(__FILE__ ": known to be broken near zeros\n"); - break; + if (fabsf(d) < 0x1p23f) + printf("X "); + else + err++; + printf("%s:%d: %s j0f(%a) want %a got %a ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); } } return !!err; diff --git a/src/math/jn.c b/src/math/jn.c index fc1b5d4..6a64683 100644 --- a/src/math/jn.c +++ b/src/math/jn.c @@ -34,9 +34,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabsf(d) < 3.0f) + printf("X "); + else + err++; printf("%s:%d: %s jn(%lld, %a) want %a got %a, ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->i, p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/jnf.c b/src/math/jnf.c index f9330a3..fa5265c 100644 --- a/src/math/jnf.c +++ b/src/math/jnf.c @@ -35,9 +35,12 @@ int main(void) } d = ulperrf(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabsf(d) < 3.0f) + printf("X "); + else + err++; printf("%s:%d: %s jnf(%lld, %a) want %a got %a, ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->i, p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/lgamma.c b/src/math/lgamma.c index b20a693..98731c0 100644 --- a/src/math/lgamma.c +++ b/src/math/lgamma.c @@ -15,7 +15,7 @@ int main(void) int yi; double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct d_di *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -36,10 +36,14 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) { + bad = !isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i; + if (bad || !checkulp(d, p->r)) { + if (!bad && fabsf(d) < 11.0f) + printf("X "); + else + err++; printf("%s:%d: %s lgamma(%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/lgamma_r.c b/src/math/lgamma_r.c index d9fa1ac..f7f2a25 100644 --- a/src/math/lgamma_r.c +++ b/src/math/lgamma_r.c @@ -17,7 +17,7 @@ int main(void) int yi; double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct d_di *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -37,10 +37,14 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) { + bad = !isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i; + if (bad || !checkulp(d, p->r)) { + if (!bad && fabsf(d) < 11.0f) + printf("X "); + else + err++; printf("%s:%d: %s lgamma_r(%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/lgammaf.c b/src/math/lgammaf.c index 6789717..3c6031f 100644 --- a/src/math/lgammaf.c +++ b/src/math/lgammaf.c @@ -17,7 +17,7 @@ int main(void) int yi; double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct f_fi *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -38,10 +38,14 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if (!checkulp(d, p->r) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) { + bad = !isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i; + if (bad || !checkulp(d, p->r)) { + if (!bad && fabsf(d) < 2.0f) + printf("X "); + else + err++; printf("%s:%d: %s lgammaf(%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/lgammaf_r.c b/src/math/lgammaf_r.c index 301b7b5..7c6daf3 100644 --- a/src/math/lgammaf_r.c +++ b/src/math/lgammaf_r.c @@ -17,7 +17,7 @@ int main(void) int yi; double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct f_fi *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -37,10 +37,14 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if (!checkulp(d, p->r) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) { + bad = !isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i; + if (bad || !checkulp(d, p->r)) { + if (!bad && fabsf(d) < 2.0f) + printf("X "); + else + err++; printf("%s:%d: %s lgammaf_r(%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/pow.c b/src/math/pow.c index 341582f..756b63b 100644 --- a/src/math/pow.c +++ b/src/math/pow.c @@ -29,10 +29,13 @@ int main(void) e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); if (!checkexcept(e, p->e, p->r)) { + if (fabs(y) < 0x1p-1022 && (e|INEXACT) == (INEXACT|UNDERFLOW)) + printf("X "); + else + err++; printf("%s:%d: bad fp exception: %s pow(%a,%a)=%a, want %s", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); printf(" got %s\n", estr(e)); - err++; } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { diff --git a/src/math/powf.c b/src/math/powf.c index 9709ec2..4778c2f 100644 --- a/src/math/powf.c +++ b/src/math/powf.c @@ -28,10 +28,13 @@ int main(void) e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); if (!checkexcept(e, p->e, p->r)) { + if (fabsf(y) < 0x1p-126f && (e|INEXACT) == (INEXACT|UNDERFLOW)) + printf("X "); + else + err++; printf("%s:%d: bad fp exception: %s powf(%a,%a)=%a, want %s", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); printf(" got %s\n", estr(e)); - err++; } d = ulperrf(y, p->y, p->dy); if (!checkulp(d, p->r)) { diff --git a/src/math/sin.c b/src/math/sin.c index 1449b46..e29019d 100644 --- a/src/math/sin.c +++ b/src/math/sin.c @@ -36,9 +36,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (p->r != RN) + printf("X "); + else + err++; printf("%s:%d: %s sin(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/sinh.c b/src/math/sinh.c index 73cdc7d..4373168 100644 --- a/src/math/sinh.c +++ b/src/math/sinh.c @@ -36,9 +36,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabsf(d) < 2.0f || p->r != RN) + printf("X "); + else + err++; printf("%s:%d: %s sinh(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/sinhf.c b/src/math/sinhf.c index 8126f5d..f4e38ec 100644 --- a/src/math/sinhf.c +++ b/src/math/sinhf.c @@ -35,9 +35,12 @@ int main(void) } d = ulperrf(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (p->r != RN) + printf("X "); + else + err++; printf("%s:%d: %s sinhf(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/sinhl.c b/src/math/sinhl.c index 8ea0380..aa85d8a 100644 --- a/src/math/sinhl.c +++ b/src/math/sinhl.c @@ -42,9 +42,12 @@ int main(void) } d = ulperrl(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (fabsf(d) < 5.0f || p->r != RN) + printf("X "); + else + err++; printf("%s:%d: %s sinhl(%La) want %La got %La ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/tan.c b/src/math/tan.c index 88d88b0..a856f96 100644 --- a/src/math/tan.c +++ b/src/math/tan.c @@ -36,9 +36,12 @@ int main(void) } d = ulperr(y, p->y, p->dy); if (!checkulp(d, p->r)) { + if (p->r != RN) + printf("X "); + else + err++; printf("%s:%d: %s tan(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/tgamma.c b/src/math/tgamma.c index 18992fe..6f69bae 100644 --- a/src/math/tgamma.c +++ b/src/math/tgamma.c @@ -33,11 +33,13 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - // TODO: 2 ulp errors allowed - if (p->r==RN && fabs(d)>2) { + if (!checkulp(d, p->r)) { + if (fabsf(d) < 5.5f) + printf("X "); + else + err++; printf("%s:%d: %s tgamma(%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err; diff --git a/src/math/y0.c b/src/math/y0.c index 2ea45f7..b5b97b8 100644 --- a/src/math/y0.c +++ b/src/math/y0.c @@ -14,7 +14,7 @@ int main(void) #pragma STDC FENV_ACCESS ON double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct d_d *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -34,13 +34,14 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if ((!(p->x < 0) && !checkulp(d, p->r)) || (p->x < 0 && !isnan(y) && y != -inf)) { -// printf("%s:%d: %s y0(%a) want %a got %a ulperr %.3f = %a + %a\n", -// p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; - // TODO: avoid spamming the output - printf(__FILE__ ": known to be broken near zeros\n"); - break; + bad = p->x < 0 && !isnan(y) && y != -inf; + if (bad || (!(p->x < 0) && !checkulp(d, p->r))) { + if (!bad && fabsf(d) < 0x1p52f) + printf("X "); + else + err++; + printf("%s:%d: %s y0(%a) want %a got %a ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); } } return !!err; diff --git a/src/math/y0f.c b/src/math/y0f.c index 4ab4883..d015279 100644 --- a/src/math/y0f.c +++ b/src/math/y0f.c @@ -15,7 +15,7 @@ int main(void) #pragma STDC FENV_ACCESS ON float y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct f_f *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -35,13 +35,14 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if ((!(p->x < 0) && !checkulp(d, p->r)) || (p->x < 0 && !isnan(y) && y != -inf)) { -// printf("%s:%d: %s y0f(%a) want %a got %a ulperr %.3f = %a + %a\n", -// p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); - err++; - // TODO: avoid spamming the output - printf(__FILE__ ": known to be broken near zeros\n"); - break; + bad = p->x < 0 && !isnan(y) && y != -inf; + if (bad || (!(p->x < 0) && !checkulp(d, p->r))) { + if (!bad && fabsf(d) < 0x1p23f) + printf("X "); + else + err++; + printf("%s:%d: %s y0f(%a) want %a got %a ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy); } } return !!err; diff --git a/src/math/ynf.c b/src/math/ynf.c index 983592b..8d98977 100644 --- a/src/math/ynf.c +++ b/src/math/ynf.c @@ -14,7 +14,7 @@ int main(void) #pragma STDC FENV_ACCESS ON double y; float d; - int e, i, err = 0; + int e, i, bad, err = 0; struct fi_f *p; for (i = 0; i < sizeof t/sizeof *t; i++) { @@ -34,10 +34,14 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if ((!(p->x < 0) && !checkulp(d, p->r)) || (p->x < 0 && !isnan(y) && y != -inf)) { + bad = p->x < 0 && !isnan(y) && y != -inf; + if (bad || (!(p->x < 0) && !checkulp(d, p->r))) { + if (!bad && fabsf(d) < 2.5f) + printf("X "); + else + err++; printf("%s:%d: %s ynf(%lld, %a) want %a got %a, ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->i, p->x, p->y, y, d, d-p->dy, p->dy); - err++; } } return !!err;