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