1 #include <stdint.h>
2 #include <stdio.h>
3 #include "mtest.h"
4
5 static struct l_l t[] = {
6 #if LDBL_MANT_DIG == 53
7 #include "sanity/asinh.h"
8 #include "special/asinh.h"
9
10 #elif LDBL_MANT_DIG == 64
11 #include "sanity/asinhl.h"
12 #include "special/asinhl.h"
13
14 #elif LDBL_MANT_DIG == 113
15 #ifdef LD128_ENABLE
16 #include "ld128/asinhl.h"
17 #endif
18
19 #endif
20 };
21
main(void)22 int main(void)
23 {
24 #pragma STDC FENV_ACCESS ON
25 long double y;
26 float d;
27 int e, i, err = 0;
28 struct l_l *p;
29
30 for (i = 0; i < sizeof t/sizeof *t; i++) {
31 p = t + i;
32
33 if (p->r < 0)
34 continue;
35 fesetround(p->r);
36 feclearexcept(FE_ALL_EXCEPT);
37 y = asinhl(p->x);
38 e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
39
40 if (!checkexcept(e, p->e, p->r)) {
41 printf("%s:%d: bad fp exception: %s asinhl(%La)=%La, want %s",
42 p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
43 printf(" got %s\n", estr(e));
44 err++;
45 }
46 d = ulperrl(y, p->y, p->dy);
47 if (!checkulp(d, p->r)) {
48 printf("%s:%d: %s asinhl(%La) want %La got %La ulperr %.3f = %a + %a\n",
49 p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
50 err++;
51 }
52 }
53 return !!err;
54 }
55