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