add generated math tests
[libc-test.git] / src / math / nexttowardl.c
blobd09e2f8f8e65134c8e9158db214654797d987592
1 #include <stdint.h>
2 #include <stdio.h>
3 #include "util.h"
5 static struct ll_l t[] = {
6 #if LDBL_MANT_DIG == 53
8 #elif LDBL_MANT_DIG == 64
10 #endif
13 int main(void)
15 long double y;
16 float d;
17 int e, i, err = 0;
18 struct ll_l *p;
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++;
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++;
37 return !!err;