fix malloc-brk-fail
[libc-test] / src / math / gen / template / l_i.c
1 #include <stdint.h>
2 #include <stdio.h>
3 #include "util.h"
4
5 static struct l_i t[] = {
6 #if LDBL_MANT_DIG == 53
7 DHEADERS
8 #elif LDBL_MANT_DIG == 64
9 HEADERS
10 #endif
11 };
12
13 int main(void)
14 {
15         #pragma STDC FENV_ACCESS ON
16         long long yi;
17         int e, i, err = 0;
18         struct l_i *p;
19
20         for (i = 0; i < sizeof t/sizeof *t; i++) {
21                 p = t + i;
22
23                 if (p->r < 0)
24                         continue;
25                 fesetround(p->r);
26                 feclearexcept(FE_ALL_EXCEPT);
27                 yi = ___(p->x);
28                 e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
29
30                 if (!checkexcept(e, p->e, p->r)) {
31                         printf("%s:%d: bad fp exception: %s ___(%La)=%lld, want %s",
32                                 p->file, p->line, rstr(p->r), p->x, p->i, estr(p->e));
33                         printf(" got %s\n", estr(e));
34                         err++;
35                 }
36                 if (yi != p->i) {
37                         printf("%s:%d: %s ___(%La) want %lld got %lld\n",
38                                 p->file, p->line, rstr(p->r), p->x, p->i, yi);
39                         err++;
40                 }
41         }
42         return !!err;
43 }