X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fgen%2Ftemplate%2Ff_fi.c;h=4a2104e7f0591d0a8a1988bb9b2a452f731a1def;hb=2146d5e12aa52cb97f0a151e2611967f0653a07a;hp=e697ca5394dd01240f70117819cabee91ae9e0e5;hpb=75aab93ef75299e347be24f57223dc93f2af80a4;p=libc-test diff --git a/src/math/gen/template/f_fi.c b/src/math/gen/template/f_fi.c index e697ca5..4a2104e 100644 --- a/src/math/gen/template/f_fi.c +++ b/src/math/gen/template/f_fi.c @@ -8,6 +8,7 @@ HEADERS int main(void) { + #pragma STDC FENV_ACCESS ON int yi; double y; float d; @@ -16,9 +17,14 @@ int main(void) for (i = 0; i < sizeof t/sizeof *t; i++) { p = t + i; - setupfenv(p->r); + + if (p->r < 0) + continue; + fesetround(p->r); + feclearexcept(FE_ALL_EXCEPT); y = ___(p->x, &yi); - e = getexcept(); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + if (!checkexcept(e, p->e, p->r)) { printf("%s:%d: bad fp exception: %s ___(%a)=%a,%lld, want %s", p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e)); @@ -26,7 +32,7 @@ int main(void) err++; } d = ulperrf(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkulp(d, p->r) || yi != p->i) { printf("%s:%d: %s ___(%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++;