Blame src/math/gen/template/ll_l.c

nsz f9d179
#include <stdint.h>
nsz f9d179
#include <stdio.h>
nsz f9d179
#include "util.h"
nsz f9d179
nsz f9d179
static struct ll_l t[] = {
nsz f9d179
#if LDBL_MANT_DIG == 53
nsz f9d179
DHEADERS
nsz f9d179
#elif LDBL_MANT_DIG == 64
nsz f9d179
HEADERS
nsz f9d179
#endif
nsz f9d179
};
nsz f9d179
nsz f9d179
int main(void)
nsz f9d179
{
nsz f9d179
	long double y;
nsz f9d179
	float d;
nsz f9d179
	int e, i, err = 0;
nsz f9d179
	struct ll_l *p;
nsz f9d179
nsz f9d179
	for (i = 0; i < sizeof t/sizeof *t; i++) {
nsz f9d179
		p = t + i;
nsz f9d179
		setupfenv(p->r);
nsz f9d179
		y = ___(p->x, p->x2);
nsz f9d179
		e = getexcept();
nsz f9d179
		if (!checkexcept(e, p->e, p->r)) {
nsz 457b0d
			printf("%s:%d: bad fp exception: %s ___(%La,%La)=%La, want %s",
nsz 457b0d
				p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e));
nsz f9d179
			printf(" got %s\n", estr(e));
nsz f9d179
			err++;
nsz f9d179
		}
nsz f9d179
		d = ulperrl(y, p->y, p->dy);
nsz f9d179
		if (!checkulp(d, p->r)) {
nsz 457b0d
			printf("%s:%d: %s ___(%La,%La) want %La got %La ulperr %.3f = %a + %a\n",
nsz 457b0d
				p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy);
nsz f9d179
			err++;
nsz f9d179
		}
nsz f9d179
	}
nsz f9d179
	return !!err;
nsz f9d179
}