X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Ftanh.c;h=1f3541f1279fa4c49fd73417cd3411c0f040dce9;hb=e248db1c46f61cf34548e739bc6ff106013b1ba2;hp=59d66764c2460c4ee1e3ea25aaef3b6ef45527ef;hpb=457b0dbfc1d72080f6ba9fe47cd712e0f090732a;p=libc-test diff --git a/src/math/tanh.c b/src/math/tanh.c index 59d6676..1f3541f 100644 --- a/src/math/tanh.c +++ b/src/math/tanh.c @@ -5,11 +5,13 @@ static struct d_d t[] = { #include "ucb/tanh.h" #include "sanity/tanh.h" +#include "special/tanh.h" }; int main(void) { + #pragma STDC FENV_ACCESS ON double y; float d; int e, i, err = 0; @@ -17,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 = 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));