add generated math tests
[libc-test.git] / src / math / expm1l.c
blob3bb90aaeb8fb8d0452283c3879c6ed2521a4f497
1 #include <stdint.h>
2 #include <stdio.h>
3 #include "util.h"
5 static struct l_l t[] = {
6 #if LDBL_MANT_DIG == 53
8 #include "sanity/expm1l.h"
9 #elif LDBL_MANT_DIG == 64
11 #include "sanity/expm1l.h"
12 #endif
15 int main(void)
17 long double y;
18 float d;
19 int e, i, err = 0;
20 struct l_l *p;
22 for (i = 0; i < sizeof t/sizeof *t; i++) {
23 p = t + i;
24 setupfenv(p->r);
25 y = expm1l(p->x);
26 e = getexcept();
27 if (!checkexcept(e, p->e, p->r)) {
28 printf("%s expm1l(%La)==%La except: want %s", rstr(p->r), p->x, p->y, estr(p->e));
29 printf(" got %s\n", estr(e));
30 err++;
32 d = ulperrl(y, p->y, p->dy);
33 if (!checkulp(d, p->r)) {
34 printf("%s expm1l(%La) want %La got %La ulperr %.3f = %a + %a\n",
35 rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
36 err++;
39 return !!err;