add generated math tests
[libc-test.git] / src / math / cosh.c
blob44f9f1b23db0636459b33ef051c82e19f89c403d
1 #include <stdint.h>
2 #include <stdio.h>
3 #include "util.h"
5 static struct d_d t[] = {
7 #include "crlibm/cosh.h"
8 #include "ucb/cosh.h"
9 #include "sanity/cosh.h"
12 int main(void)
14 double y;
15 float d;
16 int e, i, err = 0;
17 struct d_d *p;
19 for (i = 0; i < sizeof t/sizeof *t; i++) {
20 p = t + i;
21 setupfenv(p->r);
22 y = cosh(p->x);
23 e = getexcept();
24 if (!checkexcept(e, p->e, p->r)) {
25 printf("%s cosh(%a)==%a except: want %s", rstr(p->r), p->x, p->y, estr(p->e));
26 printf(" got %s\n", estr(e));
27 err++;
29 d = ulperr(y, p->y, p->dy);
30 if (!checkulp(d, p->r)) {
31 printf("%s cosh(%a) want %a got %a ulperr %.3f = %a + %a\n",
32 rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
33 err++;
36 return !!err;