|
nsz |
588927 |
#include <stdint.h>
|
|
nsz |
588927 |
#include <stdio.h>
|
|
nsz |
588927 |
#include "util.h"
|
|
nsz |
588927 |
|
|
nsz |
588927 |
static struct ll_li t[] = {
|
|
nsz |
588927 |
#include "sanity/remquol.h"
|
|
Szabolcs Nagy |
f3f0ff |
#include "special/remquol.h"
|
|
nsz |
588927 |
};
|
|
nsz |
588927 |
|
|
nsz |
588927 |
int main(void)
|
|
nsz |
588927 |
{
|
|
nsz |
588927 |
#pragma STDC FENV_ACCESS ON
|
|
nsz |
588927 |
int yi;
|
|
nsz |
588927 |
long double y;
|
|
nsz |
588927 |
float d;
|
|
nsz |
588927 |
int e, i, err = 0;
|
|
nsz |
588927 |
struct ll_li *p;
|
|
nsz |
588927 |
|
|
nsz |
588927 |
for (i = 0; i < sizeof t/sizeof *t; i++) {
|
|
nsz |
588927 |
p = t + i;
|
|
nsz |
588927 |
|
|
nsz |
588927 |
if (p->r < 0)
|
|
nsz |
588927 |
continue;
|
|
nsz |
588927 |
fesetround(p->r);
|
|
nsz |
588927 |
feclearexcept(FE_ALL_EXCEPT);
|
|
nsz |
588927 |
y = remquol(p->x, p->x2, &yi);
|
|
nsz |
588927 |
e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW);
|
|
nsz |
588927 |
|
|
nsz |
588927 |
if (!checkexcept(e, p->e, p->r)) {
|
|
nsz |
588927 |
printf("%s:%d: bad fp exception: %s remquol(%La,%La)=%La,%lld, want %s",
|
|
nsz |
588927 |
p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, estr(p->e));
|
|
nsz |
588927 |
printf(" got %s\n", estr(e));
|
|
nsz |
588927 |
err++;
|
|
nsz |
588927 |
}
|
|
nsz |
588927 |
d = ulperr(y, p->y, p->dy);
|
|
Szabolcs Nagy |
b3580f |
if (!checkulp(d, p->r) ||
|
|
Szabolcs Nagy |
b3580f |
(!isnan(p->y) && (yi & 7) != (p->i & 7)) ||
|
|
Szabolcs Nagy |
b3580f |
(!isnan(p->y) && (yi < 0) != (p->i < 0))) {
|
|
nsz |
588927 |
printf("%s:%d: %s remquol(%La,%La) want %La,%lld got %La,%d ulperr %.3f = %a + %a\n",
|
|
nsz |
588927 |
p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, y, yi, d, d-p->dy, p->dy);
|
|
nsz |
588927 |
err++;
|
|
nsz |
588927 |
}
|
|
nsz |
588927 |
}
|
|
nsz |
588927 |
return !!err;
|
|
nsz |
588927 |
}
|