math: add fenv pragma, relax the error check, simplify util.h
[libc-test] / src / math / lgammaf.c
index 0ac09fc..47051e3 100644 (file)
@@ -9,6 +9,7 @@ static struct f_fi t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        int yi;
        double y;
        float d;
@@ -17,10 +18,15 @@ 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 = lgammaf(p->x);
                yi = signgam;
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s lgammaf(%a)=%a,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));