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