X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmath%2Fcopysignl.c;h=bdab602ce9ce0eaf50a77b193599036e4d8ce27f;hb=9aeadc5b0fdc9679c8c257c1a8521f76f1e3b0e7;hp=a9a702fc96a9dc946d4195d2e9324d64e3c4368b;hpb=4282b03a8c212b0e38af1876364be5f332673ce6;p=libc-test diff --git a/src/math/copysignl.c b/src/math/copysignl.c index a9a702f..bdab602 100644 --- a/src/math/copysignl.c +++ b/src/math/copysignl.c @@ -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,18 +22,24 @@ 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 copysignl(%La,%La)==%La except: want %s", rstr(p->r), p->x, p->x2, p->y, estr(p->e)); + 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)); printf(" got %s\n", estr(e)); err++; } d = ulperrl(y, p->y, p->dy); - if (!checkulp(d, p->r)) { - printf("%s copysignl(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", - rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); + if (!checkcr(y, p->y, p->r)) { + printf("%s:%d: %s copysignl(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); err++; } }