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