fix math test gen script
[libc-test] / src / math / tanl.c
1 #include <stdint.h>
2 #include <stdio.h>
3 #include "util.h"
4
5 static struct l_l t[] = {
6 #if LDBL_MANT_DIG == 53
7 #include "crlibm/tan.h"
8 #include "ucb/tan.h"
9 #include "sanity/tan.h"
10
11 #elif LDBL_MANT_DIG == 64
12 #include "sanity/tanl.h"
13
14 #endif
15 };
16
17 int main(void)
18 {
19         long double y;
20         float d;
21         int e, i, err = 0;
22         struct l_l *p;
23
24         for (i = 0; i < sizeof t/sizeof *t; i++) {
25                 p = t + i;
26                 setupfenv(p->r);
27                 y = tanl(p->x);
28                 e = getexcept();
29                 if (!checkexcept(e, p->e, p->r)) {
30                         printf("%s tanl(%La)==%La except: want %s", rstr(p->r), p->x, p->y, estr(p->e));
31                         printf(" got %s\n", estr(e));
32                         err++;
33                 }
34                 d = ulperrl(y, p->y, p->dy);
35                 if (!checkulp(d, p->r)) {
36                         printf("%s tanl(%La) want %La got %La ulperr %.3f = %a + %a\n",
37                                 rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
38                         err++;
39                 }
40         }
41         return !!err;
42 }