1 #define _DEFAULT_SOURCE 1
7 static struct f_f t
[] = {
8 #include "sanity/y0f.h"
9 #include "special/y0f.h"
15 #pragma STDC FENV_ACCESS ON
18 int e
, i
, bad
, err
= 0;
21 for (i
= 0; i
< sizeof t
/sizeof *t
; i
++) {
27 feclearexcept(FE_ALL_EXCEPT
);
29 e
= fetestexcept(INEXACT
|INVALID
|DIVBYZERO
|UNDERFLOW
|OVERFLOW
);
31 if (!checkexcept(e
, p
->e
, p
->r
)) {
32 printf("%s:%d: bad fp exception: %s y0f(%a)=%a, want %s",
33 p
->file
, p
->line
, rstr(p
->r
), p
->x
, p
->y
, estr(p
->e
));
34 printf(" got %s\n", estr(e
));
37 d
= ulperrf(y
, p
->y
, p
->dy
);
38 bad
= p
->x
< 0 && !isnan(y
) && y
!= -inf
;
39 if (bad
|| (!(p
->x
< 0) && !checkulp(d
, p
->r
))) {
40 if (!bad
&& fabsf(d
) < 0x1p
23f
)
44 printf("%s:%d: %s y0f(%a) want %a got %a ulperr %.3f = %a + %a\n",
45 p
->file
, p
->line
, rstr(p
->r
), p
->x
, p
->y
, y
, d
, d
-p
->dy
, p
->dy
);