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