Fix order of jn() arguments in error message
[libc-test.git] / src / math / lgammaf_r.c
blob278bfcf0764ecae314b0c3c9703e212a51c6a201
1 #define _BSD_SOURCE 1
2 #define _GNU_SOURCE 1
3 #include <stdint.h>
4 #include <stdio.h>
5 #include "mtest.h"
7 static struct f_fi t[] = {
8 #include "sanity/lgammaf_r.h"
9 #include "special/lgammaf_r.h"
13 int main(void)
15 #pragma STDC FENV_ACCESS ON
16 int yi;
17 double y;
18 float d;
19 int e, i, err = 0;
20 struct f_fi *p;
22 for (i = 0; i < sizeof t/sizeof *t; i++) {
23 p = t + i;
25 if (p->r < 0)
26 continue;
27 fesetround(p->r);
28 feclearexcept(FE_ALL_EXCEPT);
29 y = lgammaf_r(p->x, &yi);
30 e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
32 if (!checkexcept(e, p->e, p->r)) {
33 printf("%s:%d: bad fp exception: %s lgammaf_r(%a)=%a,%lld, want %s",
34 p->file, p->line, rstr(p->r), p->x, p->y, p->i, estr(p->e));
35 printf(" got %s\n", estr(e));
36 err++;
38 d = ulperrf(y, p->y, p->dy);
39 if (!checkulp(d, p->r) || (!isnan(p->x) && p->x!=-inf && !(p->e&DIVBYZERO) && yi != p->i)) {
40 printf("%s:%d: %s lgammaf_r(%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n",
41 p->file, p->line, rstr(p->r), p->x, p->y, p->i, y, yi, d, d-p->dy, p->dy);
42 err++;
45 return !!err;