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