memset test: fix padding size
[libc-test.git] / src / math / sin.c
blobe29019d45d415f3f09b399780c4be0490fa0e4e5
1 #include <stdint.h>
2 #include <stdio.h>
3 #include "mtest.h"
5 static struct d_d t[] = {
6 #include "crlibm/sin.h"
7 #include "ucb/sin.h"
8 #include "sanity/sin.h"
9 #include "special/sin.h"
13 int main(void)
15 #pragma STDC FENV_ACCESS ON
16 double y;
17 float d;
18 int e, i, err = 0;
19 struct d_d *p;
21 for (i = 0; i < sizeof t/sizeof *t; i++) {
22 p = t + i;
24 if (p->r < 0)
25 continue;
26 fesetround(p->r);
27 feclearexcept(FE_ALL_EXCEPT);
28 y = sin(p->x);
29 e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
31 if (!checkexcept(e, p->e, p->r)) {
32 printf("%s:%d: bad fp exception: %s sin(%a)=%a, want %s",
33 p->file, p->line, rstr(p->r), p->x, p->y, estr(p->e));
34 printf(" got %s\n", estr(e));
35 err++;
37 d = ulperr(y, p->y, p->dy);
38 if (!checkulp(d, p->r)) {
39 if (p->r != RN)
40 printf("X ");
41 else
42 err++;
43 printf("%s:%d: %s sin(%a) want %a got %a ulperr %.3f = %a + %a\n",
44 p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
47 return !!err;