math: fix nexttoward*
[libc-test] / src / math / lgammal_r.c
index bfb8efc..2ebe612 100644 (file)
@@ -14,6 +14,7 @@ static struct l_li t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        int yi;
        long double y;
        float d;
@@ -22,9 +23,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 = lgammal_r(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 lgammal_r(%La)=%La,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));