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