X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmath%2Fscalbn.c;h=9b664dc27bc6ddf0e60891612f1aeff947d05a4c;hb=1cc8c424df17d0b0522615f90717d73e86780a44;hp=317d082048dd75e52145a8dff4e5866c895dd041;hpb=75aab93ef75299e347be24f57223dc93f2af80a4;p=libc-test diff --git a/src/math/scalbn.c b/src/math/scalbn.c index 317d082..9b664dc 100644 --- a/src/math/scalbn.c +++ b/src/math/scalbn.c @@ -1,14 +1,16 @@ #include #include -#include "util.h" +#include "mtest.h" static struct di_d t[] = { #include "sanity/scalbn.h" +#include "special/scalbn.h" }; int main(void) { + #pragma STDC FENV_ACCESS ON double y; float d; int e, i, err = 0; @@ -16,17 +18,22 @@ 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 = scalbn(p->x, p->i); - e = getexcept(); - if (!checkexcept(e, p->e, p->r)) { + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexceptall(e, p->e, p->r)) { printf("%s:%d: bad fp exception: %s scalbn(%a, %lld)=%a, want %s", p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e)); printf(" got %s\n", estr(e)); err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s scalbn(%a, %lld) want %a got %a, ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->i, p->y, y, d, d-p->dy, p->dy); err++;