X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fnextafter.c;h=73c084406c1b8012ea000127b5cd921733fa1e0f;hb=113f496dbfc3cd215f852a35efe96f246f594a6c;hp=edf62e9a98cf6be670260558baab6e10a4c2bbb7;hpb=457b0dbfc1d72080f6ba9fe47cd712e0f090732a;p=libc-test diff --git a/src/math/nextafter.c b/src/math/nextafter.c index edf62e9..73c0844 100644 --- a/src/math/nextafter.c +++ b/src/math/nextafter.c @@ -3,11 +3,13 @@ #include "util.h" static struct dd_d t[] = { +#include "sanity/nextafter.h" }; int main(void) { + #pragma STDC FENV_ACCESS ON double y; float d; int e, i, err = 0; @@ -15,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 = nextafter(p->x, p->x2); - e = getexcept(); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + if (!checkexcept(e, p->e, p->r)) { printf("%s:%d: bad fp exception: %s nextafter(%a,%a)=%a, want %s", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); @@ -25,7 +32,7 @@ int main(void) err++; } d = ulperr(y, p->y, p->dy); - if (!checkulp(d, p->r)) { + if (!checkcr(y, p->y, p->r)) { printf("%s:%d: %s nextafter(%a,%a) want %a got %a ulperr %.3f = %a + %a\n", p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++;