|
nsz |
cb9f87 |
#include <stdint.h>
|
|
nsz |
cb9f87 |
#include <stdio.h>
|
|
nsz |
cb9f87 |
#include "util.h"
|
|
nsz |
cb9f87 |
|
|
nsz |
cb9f87 |
static struct l_ll t[] = {
|
|
nsz |
cb9f87 |
#if LDBL_MANT_DIG == 53
|
|
nsz |
cb9f87 |
#include "sanity/sincos.h"
|
|
Szabolcs Nagy |
f3f0ff |
#include "special/sincos.h"
|
|
nsz |
cb9f87 |
#elif LDBL_MANT_DIG == 64
|
|
nsz |
cb9f87 |
#include "sanity/sincosl.h"
|
|
Szabolcs Nagy |
f3f0ff |
#include "special/sincosl.h"
|
|
nsz |
cb9f87 |
#endif
|
|
nsz |
cb9f87 |
};
|
|
nsz |
cb9f87 |
|
|
nsz |
cb9f87 |
int main(void)
|
|
nsz |
cb9f87 |
{
|
|
nsz |
cb9f87 |
#pragma STDC FENV_ACCESS ON
|
|
nsz |
cb9f87 |
long double ysin, ycos;
|
|
nsz |
cb9f87 |
float dsin, dcos;
|
|
nsz |
cb9f87 |
int e, i, err = 0;
|
|
nsz |
cb9f87 |
struct l_ll *p;
|
|
nsz |
cb9f87 |
|
|
nsz |
cb9f87 |
for (i = 0; i < sizeof t/sizeof *t; i++) {
|
|
nsz |
cb9f87 |
p = t + i;
|
|
nsz |
cb9f87 |
|
|
nsz |
cb9f87 |
if (p->r < 0)
|
|
nsz |
cb9f87 |
continue;
|
|
nsz |
cb9f87 |
fesetround(p->r);
|
|
nsz |
cb9f87 |
feclearexcept(FE_ALL_EXCEPT);
|
|
nsz |
cb9f87 |
sincosl(p->x, &ysin, &ycos);
|
|
nsz |
cb9f87 |
e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
|
|
nsz |
cb9f87 |
|
|
nsz |
cb9f87 |
if (!checkexcept(e, p->e, p->r)) {
|
|
nsz |
cb9f87 |
printf("%s:%d: bad fp exception: %s sincosl(%La)=%La,%La, want %s",
|
|
nsz |
cb9f87 |
p->file, p->line, rstr(p->r), p->x, p->y, p->y2, estr(p->e));
|
|
nsz |
cb9f87 |
printf(" got %s\n", estr(e));
|
|
nsz |
cb9f87 |
err++;
|
|
nsz |
cb9f87 |
}
|
|
nsz |
cb9f87 |
dsin = ulperr(ysin, p->y, p->dy);
|
|
nsz |
cb9f87 |
dcos = ulperr(ycos, p->y2, p->dy2);
|
|
nsz |
cb9f87 |
if (!checkulp(dsin, p->r) || !checkulp(dcos, p->r)) {
|
|
nsz |
cb9f87 |
printf("%s:%d: %s sincosl(%La) want %La,%La got %La,%La, ulperr %.3f = %a + %a, %.3f = %a + %a\n",
|
|
nsz |
cb9f87 |
p->file, p->line, rstr(p->r), p->x, p->y, p->y2, ysin, ycos,
|
|
nsz |
cb9f87 |
dsin, dsin-p->dy, p->dy, dcos, dcos-p->dy2, p->dy2);
|
|
nsz |
cb9f87 |
err++;
|
|
nsz |
cb9f87 |
}
|
|
nsz |
cb9f87 |
}
|
|
nsz |
cb9f87 |
return !!err;
|
|
nsz |
cb9f87 |
}
|