|
nsz |
588927 |
#include <stdint.h>
|
|
nsz |
588927 |
#include <stdio.h>
|
|
Szabolcs Nagy |
cfa23c |
#include "mtest.h"
|
|
nsz |
588927 |
|
|
nsz |
588927 |
static struct lll_l t[] = {
|
|
nsz |
588927 |
#if LDBL_MANT_DIG == 53
|
|
nsz |
588927 |
#include "sanity/fma.h"
|
|
Szabolcs Nagy |
f3f0ff |
#include "special/fma.h"
|
|
nsz |
588927 |
#elif LDBL_MANT_DIG == 64
|
|
nsz |
588927 |
#include "sanity/fmal.h"
|
|
Szabolcs Nagy |
f3f0ff |
#include "special/fmal.h"
|
|
nsz |
588927 |
#endif
|
|
nsz |
588927 |
};
|
|
nsz |
588927 |
|
|
nsz |
588927 |
int main(void)
|
|
nsz |
588927 |
{
|
|
nsz |
588927 |
#pragma STDC FENV_ACCESS ON
|
|
nsz |
588927 |
long double y;
|
|
nsz |
588927 |
float d;
|
|
nsz |
588927 |
int e, i, err = 0;
|
|
nsz |
588927 |
struct lll_l *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 = fmal(p->x, p->x2, p->x3);
|
|
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 fmal(%La,%La,%La)=%La, want %s",
|
|
nsz |
588927 |
p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, estr(p->e));
|
|
nsz |
588927 |
printf(" got %s\n", estr(e));
|
|
nsz |
588927 |
err++;
|
|
nsz |
588927 |
}
|
|
nsz |
588927 |
d = ulperrl(y, p->y, p->dy);
|
|
Szabolcs Nagy |
5729b0 |
if (!checkcr(y, p->y, p->r)) {
|
|
nsz |
588927 |
printf("%s:%d: %s fmal(%La,%La,%La) want %La got %La ulperr %.3f = %a + %a\n",
|
|
nsz |
588927 |
p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, y, d, d-p->dy, p->dy);
|
|
nsz |
588927 |
err++;
|
|
nsz |
588927 |
}
|
|
nsz |
588927 |
}
|
|
nsz |
588927 |
return !!err;
|
|
nsz |
588927 |
}
|