Blame src/math/tan.c

nsz f9d179
#include <stdint.h>
nsz f9d179
#include <stdio.h>
nsz f9d179
#include "util.h"
nsz f9d179
nsz f9d179
static struct d_d t[] = {
nsz f9d179
#include "crlibm/tan.h"
nsz f9d179
#include "ucb/tan.h"
nsz f9d179
#include "sanity/tan.h"
nsz 4282b0
nsz f9d179
};
nsz f9d179
nsz f9d179
int main(void)
nsz f9d179
{
nsz f9d179
	double y;
nsz f9d179
	float d;
nsz f9d179
	int e, i, err = 0;
nsz f9d179
	struct d_d *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 = tan(p->x);
nsz f9d179
		e = getexcept();
nsz f9d179
		if (!checkexcept(e, p->e, p->r)) {
nsz f9d179
			printf("%s tan(%a)==%a except: want %s", rstr(p->r), p->x, p->y, estr(p->e));
nsz f9d179
			printf(" got %s\n", estr(e));
nsz f9d179
			err++;
nsz f9d179
		}
nsz f9d179
		d = ulperr(y, p->y, p->dy);
nsz f9d179
		if (!checkulp(d, p->r)) {
nsz f9d179
			printf("%s tan(%a) want %a got %a ulperr %.3f = %a + %a\n",
nsz f9d179
				rstr(p->r), p->x, p->y, y, d, d-p->dy, p->dy);
nsz f9d179
			err++;
nsz f9d179
		}
nsz f9d179
	}
nsz f9d179
	return !!err;
nsz f9d179
}