2 #define _XOPEN_SOURCE 700
7 static struct l_li t[] = {
8 #if LDBL_MANT_DIG == 53
9 #include "sanity/lgamma.h"
10 #include "special/lgamma.h"
12 #elif LDBL_MANT_DIG == 64
13 #include "sanity/lgammal.h"
14 #include "special/lgammal.h"
21 #pragma STDC FENV_ACCESS ON
28 for (i = 0; i < sizeof t/sizeof *t; i++) {
34 feclearexcept(FE_ALL_EXCEPT);
37 e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
39 if (!checkexcept(e, p->e, p->r)) {
40 printf("%s:%d: bad fp exception: %s lgammal(%La)=%La,%lld, want %s",
41 p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
42 printf(" got %s\n", estr(e));
45 d = ulperrl(y, p->y, p->dy);
46 // TODO: 2 ulp errors allowed
47 if ((p->r==RN && fabs(d) > 2) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) {
48 printf("%s:%d: %s lgammal(%La) want %La,%lld got %La,%d ulperr %.3f = %a + %a\n",
49 p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy);