math: add fenv pragma, relax the error check, simplify util.h
authornsz <nsz@port70.net>
Tue, 9 Oct 2012 18:51:22 +0000 (20:51 +0200)
committernsz <nsz@port70.net>
Tue, 9 Oct 2012 18:51:22 +0000 (20:51 +0200)
176 files changed:
src/math/Makefile
src/math/acos.c
src/math/acosf.c
src/math/acosh.c
src/math/acoshf.c
src/math/acoshl.c
src/math/acosl.c
src/math/asin.c
src/math/asinf.c
src/math/asinh.c
src/math/asinhf.c
src/math/asinhl.c
src/math/asinl.c
src/math/atan.c
src/math/atan2.c
src/math/atan2f.c
src/math/atan2l.c
src/math/atanf.c
src/math/atanh.c
src/math/atanhf.c
src/math/atanhl.c
src/math/atanl.c
src/math/cbrt.c
src/math/cbrtf.c
src/math/cbrtl.c
src/math/ceil.c
src/math/ceilf.c
src/math/ceill.c
src/math/copysign.c
src/math/copysignf.c
src/math/copysignl.c
src/math/cos.c
src/math/cosf.c
src/math/cosh.c
src/math/coshf.c
src/math/coshl.c
src/math/cosl.c
src/math/erf.c
src/math/erfc.c
src/math/erfcf.c
src/math/erfcl.c
src/math/erff.c
src/math/erfl.c
src/math/exp.c
src/math/exp10.c
src/math/exp10f.c
src/math/exp10l.c
src/math/exp2.c
src/math/exp2f.c
src/math/exp2l.c
src/math/expf.c
src/math/expl.c
src/math/expm1.c
src/math/expm1f.c
src/math/expm1l.c
src/math/fabs.c
src/math/fabsf.c
src/math/fabsl.c
src/math/fdim.c
src/math/fdimf.c
src/math/fdiml.c
src/math/floor.c
src/math/floorf.c
src/math/floorl.c
src/math/fmax.c
src/math/fmaxf.c
src/math/fmaxl.c
src/math/fmin.c
src/math/fminf.c
src/math/fminl.c
src/math/fmod.c
src/math/fmodf.c
src/math/fmodl.c
src/math/frexp.c
src/math/frexpf.c
src/math/frexpl.c
src/math/gen/template/d_d.c
src/math/gen/template/d_di.c
src/math/gen/template/dd_d.c
src/math/gen/template/di_d.c
src/math/gen/template/f_f.c
src/math/gen/template/f_fi.c
src/math/gen/template/ff_f.c
src/math/gen/template/fi_f.c
src/math/gen/template/l_l.c
src/math/gen/template/l_li.c
src/math/gen/template/li_l.c
src/math/gen/template/ll_l.c
src/math/hypot.c
src/math/hypotf.c
src/math/hypotl.c
src/math/j0.c
src/math/j0f.c
src/math/j1.c
src/math/j1f.c
src/math/ldexp.c
src/math/ldexpf.c
src/math/ldexpl.c
src/math/lgamma.c
src/math/lgamma_r.c
src/math/lgammaf.c
src/math/lgammaf_r.c
src/math/lgammal.c
src/math/lgammal_r.c
src/math/log.c
src/math/log10.c
src/math/log10f.c
src/math/log10l.c
src/math/log1p.c
src/math/log1pf.c
src/math/log1pl.c
src/math/log2.c
src/math/log2f.c
src/math/log2l.c
src/math/logb.c
src/math/logbf.c
src/math/logbl.c
src/math/logf.c
src/math/logl.c
src/math/nearbyint.c
src/math/nearbyintf.c
src/math/nearbyintl.c
src/math/nextafter.c
src/math/nextafterf.c
src/math/nextafterl.c
src/math/nexttowardl.c
src/math/pow.c
src/math/pow10.c
src/math/pow10f.c
src/math/pow10l.c
src/math/powf.c
src/math/powl.c
src/math/remainder.c
src/math/remainderf.c
src/math/remainderl.c
src/math/rint.c
src/math/rintf.c
src/math/rintl.c
src/math/round.c
src/math/roundf.c
src/math/roundl.c
src/math/scalb.c
src/math/scalbf.c
src/math/scalbln.c
src/math/scalblnf.c
src/math/scalblnl.c
src/math/scalbn.c
src/math/scalbnf.c
src/math/scalbnl.c
src/math/sin.c
src/math/sinf.c
src/math/sinh.c
src/math/sinhf.c
src/math/sinhl.c
src/math/sinl.c
src/math/sqrt.c
src/math/sqrtf.c
src/math/sqrtl.c
src/math/tan.c
src/math/tanf.c
src/math/tanh.c
src/math/tanhf.c
src/math/tanhl.c
src/math/tanl.c
src/math/tgamma.c
src/math/tgammaf.c
src/math/tgammal.c
src/math/trunc.c
src/math/truncf.c
src/math/truncl.c
src/math/util.c
src/math/util.h
src/math/y0.c
src/math/y0f.c
src/math/y1.c
src/math/y1f.c

index e251c6d..8c640ac 100644 (file)
@@ -1,5 +1,5 @@
 CFLAGS+=-g -pipe -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wno-unused-function -Wno-missing-braces
-CFLAGS+=-fno-builtin -D_GNU_SOURCE
+CFLAGS+=-Wno-unknown-pragmas -fno-builtin -ffloat-store -frounding-math -D_GNU_SOURCE
 LDFLAGS+=-g -lm
 
 SRC=$(sort $(wildcard *.c))
@@ -17,7 +17,7 @@ clean:
 
 $(BIN): util.o
 
-%.o: %.c sanity/%.h ucb/%.h crlibm/%.h
+%.o: %.c sanity/%.h ucb/%.h crlibm/%.h util.h
        $(CC) $(CFLAGS) -c -o $@ $<
 %: %.c
 %: %.o
index f9d28f0..09c1dd2 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = acos(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s acos(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index fb20f89..8a35f06 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = acosf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s acosf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 60680c2..c0620d8 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = acosh(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s acosh(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 60ceb58..37a29b9 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = acoshf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s acoshf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 63a7334..d4146ee 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = acoshl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s acoshl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index ecd6f62..5ac9a79 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = acosl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s acosl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 193264c..64d950c 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = asin(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s asin(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 0fe46b8..38a3e9f 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = asinf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s asinf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 132e942..fc9e68c 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = asinh(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s asinh(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index e2681dd..90260e1 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = asinhf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s asinhf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index b65aff4..8be196e 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = asinhl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s asinhl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 9fc0982..1084c79 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = asinl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s asinl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 527aeb2..825f2ce 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = atan(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s atan(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index a0b55ab..0772893 100644 (file)
@@ -10,6 +10,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = atan2(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 atan2(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 872ef59..e5d742d 100644 (file)
@@ -10,6 +10,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = atan2f(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 atan2f(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index c809e67..d6d5ae4 100644 (file)
@@ -15,6 +15,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = atan2l(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 atan2l(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index c3f016b..3e35a3c 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = atanf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s atanf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 55dfa1c..ec41ac5 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = atanh(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s atanh(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index a772971..3fa6c33 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = atanhf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s atanhf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 230c1da..4d986da 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = atanhl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s atanhl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 0aee4a4..73d7993 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = atanl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s atanl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4faf739..55ecc5a 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = cbrt(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cbrt(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 9737fbb..305d03f 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = cbrtf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cbrtf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 037a397..79f1749 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = cbrtl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cbrtl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index ab6be5f..65c587d 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = ceil(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ceil(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index dbc18d5..4b0a317 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = ceilf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ceilf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4971447..d3a3ed4 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = ceill(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ceill(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 2f1464c..1f27fd0 100644 (file)
@@ -9,6 +9,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = copysign(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 copysign(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 8456a8f..a53f6f2 100644 (file)
@@ -9,6 +9,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = copysignf(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 copysignf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 7849aa9..8e21ba1 100644 (file)
@@ -14,6 +14,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = copysignl(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 copysignl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 74bc57b..485efad 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = cos(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cos(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index cf9aa29..4dc55cd 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = cosf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cosf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 29f3ef5..6820d09 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = cosh(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cosh(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 955736c..b2ec5b0 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = coshf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s coshf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 880737a..0dc737e 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = coshl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s coshl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 8788a95..cb11ddc 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = cosl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s cosl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 6d085dc..cb60a63 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = erf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s erf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index fb9fe9b..6834d5d 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = erfc(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s erfc(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 39629b0..d226d40 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = erfcf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s erfcf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 8720138..4e7ffec 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = erfcl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s erfcl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 5b95fd3..a399e50 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = erff(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s erff(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index b03cc74..753885d 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = erfl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s erfl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 6f27409..e7a77a7 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = exp(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index dff72a7..49cc61a 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = exp10(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp10(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index b0b1645..3ed2232 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = exp10f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp10f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 273e816..3651a6d 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = exp10l(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp10l(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 2d2567e..0a1ccb6 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = exp2(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp2(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 02eb8fb..9d29780 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = exp2f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp2f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index f283edf..72d6ead 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = exp2l(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s exp2l(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index f80c64b..87d8c5c 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = expf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s expf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index e65d6e4..6e118df 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = expl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s expl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 9780a97..70fdfef 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = expm1(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s expm1(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 3c1dc94..6f72d47 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = expm1f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s expm1f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 1668f63..7950542 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = expm1l(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s expm1l(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 1cd8716..6a93081 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = fabs(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s fabs(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4c418b8..1dc99b4 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = fabsf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s fabsf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 5963f51..df170ea 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = fabsl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s fabsl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 0857a49..c3177de 100644 (file)
@@ -9,6 +9,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = fdim(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 fdim(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 1c940b9..56dac2f 100644 (file)
@@ -9,6 +9,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = fdimf(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 fdimf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 1f41eda..9f07940 100644 (file)
@@ -14,6 +14,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = fdiml(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 fdiml(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 1e4928f..1a8f809 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = floor(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s floor(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4b71391..2808f13 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = floorf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s floorf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index a6856e3..42c79de 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = floorl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s floorl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 938361c..f0ae9a7 100644 (file)
@@ -9,6 +9,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = fmax(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 fmax(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index febb8a7..9268786 100644 (file)
@@ -9,6 +9,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = fmaxf(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 fmaxf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index e074e13..5f4f1f3 100644 (file)
@@ -14,6 +14,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = fmaxl(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 fmaxl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index eae3d64..d18387d 100644 (file)
@@ -9,6 +9,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = fmin(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 fmin(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 5727b73..db85a51 100644 (file)
@@ -9,6 +9,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = fminf(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 fminf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index fb6b17f..aca8246 100644 (file)
@@ -14,6 +14,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = fminl(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 fminl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 8c7765f..3e66c95 100644 (file)
@@ -10,6 +10,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = fmod(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 fmod(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 3396b4e..d92a7e6 100644 (file)
@@ -10,6 +10,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = fmodf(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 fmodf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 15486cb..7f715e3 100644 (file)
@@ -15,6 +15,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = fmodl(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 fmodl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 19bc401..73a415e 100644 (file)
@@ -9,6 +9,7 @@ static struct d_di t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        int yi;
        double y;
        float d;
@@ -17,9 +18,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 = frexp(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 frexp(%a)=%a,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
index e4f05c1..f43da51 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,9 +18,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 = frexpf(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 frexpf(%a)=%a,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
index 9d56bf2..275e979 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 = frexpl(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 frexpl(%La)=%La,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
index 9a7ba82..36bd0c5 100644 (file)
@@ -8,6 +8,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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);
-               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, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 3b224fa..efe20fd 100644 (file)
@@ -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));
index 2f46d1d..9537e98 100644 (file)
@@ -8,6 +8,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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, 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 ___(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 43fa506..bedd3cb 100644 (file)
@@ -8,6 +8,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ___(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index 4538c6b..d5aa993 100644 (file)
@@ -8,6 +8,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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);
-               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, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index e697ca5..1e19a4c 100644 (file)
@@ -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));
index 6b3ae58..30c64bc 100644 (file)
@@ -8,6 +8,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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, 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 ___(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index b989822..d6b0b0d 100644 (file)
@@ -8,6 +8,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ___(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index 82c9003..54e589d 100644 (file)
@@ -12,6 +12,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -19,9 +20,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);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ___(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 1bfa9de..32c6a0e 100644 (file)
@@ -12,6 +12,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        int yi;
        long double y;
        float d;
@@ -20,9 +21,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 ___(%La)=%La,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
index b11e461..540fa2d 100644 (file)
@@ -12,6 +12,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -19,9 +20,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, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ___(%La, %lld)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index 09178bd..962cce4 100644 (file)
@@ -12,6 +12,7 @@ HEADERS
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -19,9 +20,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, 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 ___(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index eef74b1..842ceb4 100644 (file)
@@ -10,6 +10,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = hypot(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 hypot(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 91f5a2d..7b47807 100644 (file)
@@ -10,6 +10,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = hypotf(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 hypotf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index d84c6c8..290bc80 100644 (file)
@@ -15,6 +15,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = hypotl(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 hypotl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index c40d4f0..e1faf28 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = j0(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s j0(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 94a213c..6349596 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = j0f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s j0f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4d620f9..c21721b 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = j1(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s j1(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index c6efdb7..38123fb 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = j1f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s j1f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 7605945..4ab011f 100644 (file)
@@ -9,6 +9,7 @@ static struct di_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = ldexp(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ldexp(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index dd0f8b8..01b037c 100644 (file)
@@ -9,6 +9,7 @@ static struct fi_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = ldexpf(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ldexpf(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index ddd867b..f1c6439 100644 (file)
@@ -14,6 +14,7 @@ static struct li_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = ldexpl(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s ldexpl(%La, %lld)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index 301a967..d76538f 100644 (file)
@@ -9,6 +9,7 @@ static struct d_di 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 = lgamma(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 lgamma(%a)=%a,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
index 87ccada..c2acb99 100644 (file)
@@ -9,6 +9,7 @@ static struct d_di t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        int yi;
        double y;
        float d;
@@ -17,9 +18,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 = lgamma_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 lgamma_r(%a)=%a,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
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));
index a81b644..11ca8e3 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,9 +18,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 = lgammaf_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 lgammaf_r(%a)=%a,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
index ef25118..d282de2 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,10 +23,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 = lgammal(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 lgammal(%La)=%La,%lld, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
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));
index c0150f2..5e5d5c4 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = log(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index d93d600..91558cd 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = log10(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log10(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index d9cf952..90689f5 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = log10f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log10f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index d5fea94..5548ec7 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = log10l(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log10l(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 8824d1c..0f96339 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = log1p(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log1p(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index e1ae18a..fb738f6 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = log1pf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log1pf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 08964bd..07b0afa 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = log1pl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log1pl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 283c813..25b8b2e 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = log2(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log2(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 333fc85..75e5991 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = log2f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log2f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 28e2b3f..a1a7315 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = log2l(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s log2l(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 52fcbb0..597bd51 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = logb(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s logb(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 7595cf1..12f4757 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = logbf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s logbf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 6cb7005..2c70eda 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = logbl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s logbl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index aa5863c..fbead36 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = logf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s logf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index c1a534f..c9c27be 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = logl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s logl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 988555f..927f129 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = nearbyint(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s nearbyint(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 7f65ba2..13de8ed 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = nearbyintf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s nearbyintf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index d819f25..9bbc94e 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = nearbyintl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s nearbyintl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index edf62e9..02c6edc 100644 (file)
@@ -8,6 +8,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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));
index 2550bbd..e0aae93 100644 (file)
@@ -8,6 +8,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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 = nextafterf(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 nextafterf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index cbdf287..23b94fd 100644 (file)
@@ -12,6 +12,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -19,9 +20,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 = nextafterl(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 nextafterl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 19525dd..f38c36e 100644 (file)
@@ -12,6 +12,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -19,9 +20,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 = nexttowardl(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 nexttowardl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index ef7129b..f705f17 100644 (file)
@@ -11,6 +11,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = pow(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 pow(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index a487aa5..c85b517 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = pow10(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s pow10(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 74f53f4..fd2a485 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = pow10f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s pow10f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index c1d2a23..3f1abae 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = pow10l(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s pow10l(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 054671a..f11c260 100644 (file)
@@ -10,6 +10,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = powf(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 powf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 7c94362..8ceb6f1 100644 (file)
@@ -16,6 +16,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = powl(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 powl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 45321a5..4faa6d4 100644 (file)
@@ -9,6 +9,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = remainder(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 remainder(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index bbaebcb..6156c98 100644 (file)
@@ -9,6 +9,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = remainderf(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 remainderf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 08305e7..5ce0f97 100644 (file)
@@ -14,6 +14,7 @@ static struct ll_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = remainderl(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 remainderl(%La,%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index e4e1009..5cadc61 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = rint(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s rint(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 707fdb1..6fc6f5a 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = rintf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s rintf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 331796c..bda368e 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = rintl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s rintl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index fa6e3b7..a3fd5e9 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = round(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s round(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 78a5dae..d572d94 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = roundf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s roundf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 53c0b53..f4fa024 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = roundl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s roundl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 133f077..88b529b 100644 (file)
@@ -8,6 +8,7 @@ static struct dd_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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 = scalb(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 scalb(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index 6fe28a9..d91dff4 100644 (file)
@@ -8,6 +8,7 @@ static struct ff_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -15,9 +16,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 = scalbf(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 scalbf(%a,%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
index a53dc39..0231ceb 100644 (file)
@@ -9,6 +9,7 @@ static struct di_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = scalbln(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s scalbln(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index ccb7eec..f80c3fc 100644 (file)
@@ -9,6 +9,7 @@ static struct fi_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = scalblnf(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s scalblnf(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index b06c407..71ef477 100644 (file)
@@ -14,6 +14,7 @@ static struct li_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = scalblnl(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s scalblnl(%La, %lld)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index 317d082..99fdc1b 100644 (file)
@@ -9,6 +9,7 @@ static struct di_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = scalbn(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(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));
index 5391264..de588a2 100644 (file)
@@ -9,6 +9,7 @@ static struct fi_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = scalbnf(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s scalbnf(%a, %lld)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index fe26540..05ad3d9 100644 (file)
@@ -14,6 +14,7 @@ static struct li_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = scalbnl(p->x, p->i);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s scalbnl(%La, %lld)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->i, p->y, estr(p->e));
index 0eb1b10..1500162 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = sin(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sin(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index efb695a..4b8c427 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = sinf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sinf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index d57f629..08e1a0f 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = sinh(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sinh(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index ba0556e..d67f91c 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = sinhf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sinhf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 05b4adb..654292d 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = sinhl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sinhl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 73ce9f0..399baf6 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = sinl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sinl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 09dbb31..29ff800 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = sqrt(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sqrt(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 7c00fd0..6c3fb04 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = sqrtf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sqrtf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4b8c9f4..24d5b59 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = sqrtl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s sqrtl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 1751e6d..86c69b4 100644 (file)
@@ -11,6 +11,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -18,9 +19,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 = tan(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tan(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4b69e6f..5e0759a 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = tanf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tanf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 59d6676..59376e1 100644 (file)
@@ -10,6 +10,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = tanh(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tanh(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 3c46171..effeb49 100644 (file)
@@ -10,6 +10,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -17,9 +18,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 = tanhf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tanhf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 1f35a06..af9629b 100644 (file)
@@ -15,6 +15,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -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 = tanhl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tanhl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 8165b36..c4980ab 100644 (file)
@@ -16,6 +16,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -23,9 +24,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 = tanl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tanl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index d67270f..f286a62 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = tgamma(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tgamma(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 424e3c7..4d841a4 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = tgammaf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tgammaf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 28bc4a8..6bfffeb 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = tgammal(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s tgammal(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 5d09d84..49c50e0 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = trunc(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s trunc(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 5eebc7e..1df8781 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = truncf(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s truncf(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 686343f..11125b2 100644 (file)
@@ -14,6 +14,7 @@ static struct l_l t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        long double y;
        float d;
        int e, i, err = 0;
@@ -21,9 +22,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 = truncl(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s truncl(%La)=%La, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 3875695..1892173 100644 (file)
@@ -127,15 +127,3 @@ char *rstr(int r)
        }
        return "R?";
 }
-
-void setupfenv(int r)
-{
-       fesetround(r);
-       feclearexcept(FE_ALL_EXCEPT);
-}
-
-int getexcept(void)
-{
-       return fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
-}
-
index 10d9279..b24046d 100644 (file)
@@ -82,31 +82,25 @@ struct li_l {POS int r; long double x; long long i; long double y; float dy; int
 
 char *estr(int);
 char *rstr(int);
-int rconv(int *, char *);
-int econv(int *, char *);
-
-int eulp(double);
-int eulpf(float);
-int eulpl(long double);
 
 float ulperr(double got, double want, float dwant);
 float ulperrf(float got, float want, float dwant);
 float ulperrl(long double got, long double want, float dwant);
 
-void setupfenv(int);
-int getexcept(void);
-
 static int checkexcept(int got, int want, int r)
 {
+       // TODO: we dont checkunderflow and inexact for now
        if (r == RN)
-               return got == want || got == (want|INEXACT);
-       return 1; //(got|INEXACT|UNDERFLOW) == (want|INEXACT|UNDERFLOW);
+               return (got|INEXACT|UNDERFLOW) == (want|INEXACT|UNDERFLOW);
+//             return got == want || got == (want|INEXACT);
+       return 1;
 }
 
 static int checkulp(float d, int r)
 {
+       // TODO: we only care about >=1.5 ulp errors for now, should be 1.0
        if (r == RN)
-               return fabsf(d) <= 1.0;
-       return 1; //fabsf(d) <= 2.0;
+               return fabsf(d) < 1.5;
+       return 1;
 }
 
index 41edba4..2998660 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = y0(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s y0(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 4ff83f7..3b74777 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = y0f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s y0f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 166293b..a5e3b6a 100644 (file)
@@ -9,6 +9,7 @@ static struct d_d t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        double y;
        float d;
        int e, i, err = 0;
@@ -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 = y1(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s y1(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
index 3498434..d396b61 100644 (file)
@@ -9,6 +9,7 @@ static struct f_f t[] = {
 
 int main(void)
 {
+       #pragma STDC FENV_ACCESS ON
        float y;
        float d;
        int e, i, err = 0;
@@ -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 = y1f(p->x);
-               e = getexcept();
+               e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
+
                if (!checkexcept(e, p->e, p->r)) {
                        printf("%s:%d: bad fp exception: %s y1f(%a)=%a, want %s",
                                p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));