fix malloc-brk-fail
[libc-test.git] / src / math / j1f.c
blob640bb10f6aba9dd3e25a33bbcb19eff03d57c7a4
1 #define _DEFAULT_SOURCE 1
2 #define _BSD_SOURCE 1
3 #include <stdint.h>
4 #include <stdio.h>
5 #include "mtest.h"
7 static struct f_f t[] = {
8 #include "sanity/j1f.h"
9 #include "special/j1f.h"
13 int main(void)
15 #pragma STDC FENV_ACCESS ON
16 float y;
17 float d;
18 int e, i, err = 0;
19 struct f_f *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 = j1f(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 j1f(%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 = ulperrf(y, p->y, p->dy);
38 if (!checkulp(d, p->r)) {
39 printf("%s:%d: %s j1f(%a) want %a got %a ulperr %.3f = %a + %a\n",
40 p->file, p->line, rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
41 err++;
44 return !!err;