math: print file:line in the error msg, fix nearbyint 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:%d: bad fp exception: %s scalb(%a,%a)=%a, want %s",
23                                 p->file, p->line, rstr(p->r), p->x, p->x2, 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:%d: %s scalb(%a,%a) want %a got %a ulperr %.3f = %a + %a\n",
30                                 p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy);
31                         err++;
32                 }
33         }
34         return !!err;
35 }