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