1 #define _XOPEN_SOURCE 700
6 static struct d_di t[] = {
7 #include "sanity/lgamma.h"
8 #include "special/lgamma.h"
14 #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);
30 e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
32 if (!checkexcept(e, p->e, p->r)) {
33 printf("%s:%d: bad fp exception: %s lgamma(%a)=%a,%lld, want %s",
34 p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
35 printf(" got %s\n", estr(e));
38 d = ulperr(y, p->y, p->dy);
39 bad = !isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i;
40 if (bad || !checkulp(d, p->r)) {
41 if (!bad && fabsf(d) < 11.0f)
45 printf("%s:%d: %s lgamma(%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n",
46 p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy);