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