From ddfb9f92381086ef0b29f6fdddee3f7e51fb82e1 Mon Sep 17 00:00:00 2001 From: nsz Date: Sat, 13 Oct 2012 15:17:51 +0200 Subject: [PATCH] math: add nextafter*, nextoward* and scalb to gen --- src/math/gen/functions.h | 2 ++ src/math/gen/gensanity.sh | 51 +++++++++++++++++++++++++++ src/math/gen/mp.c | 65 +++++++++++++++++++++++++++++++---- src/math/gen/mplibm.c | 16 +++++++++ src/math/gen/template/ll_d.c | 45 ++++++++++++++++++++++++ src/math/gen/template/ll_f.c | 45 ++++++++++++++++++++++++ src/math/nextafter.c | 1 + src/math/nextafterf.c | 1 + src/math/nextafterl.c | 2 ++ src/math/nexttoward.c | 47 +++++++++++++++++++++++++ src/math/nexttowardf.c | 47 +++++++++++++++++++++++++ src/math/nexttowardl.c | 2 ++ src/math/sanity/nextafter.h | 10 ++++++ src/math/sanity/nextafterf.h | 10 ++++++ src/math/sanity/nextafterl.h | 10 ++++++ src/math/sanity/nexttoward.h | 10 ++++++ src/math/sanity/nexttowardf.h | 10 ++++++ src/math/sanity/nexttowardl.h | 10 ++++++ src/math/sanity/scalb.h | 10 ++++++ src/math/sanity/scalbf.h | 10 ++++++ src/math/scalb.c | 1 + src/math/scalbf.c | 1 + 22 files changed, 400 insertions(+), 6 deletions(-) create mode 100755 src/math/gen/gensanity.sh create mode 100644 src/math/gen/template/ll_d.c create mode 100644 src/math/gen/template/ll_f.c create mode 100644 src/math/nexttoward.c create mode 100644 src/math/nexttowardf.c create mode 100644 src/math/sanity/nextafter.h create mode 100644 src/math/sanity/nextafterf.h create mode 100644 src/math/sanity/nextafterl.h create mode 100644 src/math/sanity/nexttoward.h create mode 100644 src/math/sanity/nexttowardf.h create mode 100644 src/math/sanity/nexttowardl.h create mode 100644 src/math/sanity/scalb.h create mode 100644 src/math/sanity/scalbf.h diff --git a/src/math/gen/functions.h b/src/math/gen/functions.h index c13a166..bdf0be8 100644 --- a/src/math/gen/functions.h +++ b/src/math/gen/functions.h @@ -91,6 +91,8 @@ T(nearbyintl, l_l) T(nextafter, dd_d) T(nextafterf, ff_f) T(nextafterl, ll_l) +T(nexttoward, ll_d) +T(nexttowardf, ll_f) T(nexttowardl, ll_l) T(pow, dd_d) T(powf, ff_f) diff --git a/src/math/gen/gensanity.sh b/src/math/gen/gensanity.sh new file mode 100755 index 0000000..3577059 --- /dev/null +++ b/src/math/gen/gensanity.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +D=../sanity + +sed 's/^T(//;s/,//;s/)//' functions.h | while read N T +do + case $T in + d_*|f_*|l_*) ./gen $N >$D/$N.h <$D/$N.h <$D/$N.h <e&=~INEXACT, 0); } int mpnearbyintf(struct t *t) { return mpf1(t, wrap_nearbyint) || (t->e&=~INEXACT, 0); } int mpnearbyintl(struct t *t) { return mpl1(t, wrap_nearbyint) || (t->e&=~INEXACT, 0); } -int mpnextafter(struct t *t) { return -1; } -int mpnextafterf(struct t *t) { return -1; } -int mpnextafterl(struct t *t) { return -1; } -int mpnexttowardl(struct t *t) { return -1; } +// TODO: hard to implement with mpfr +int mpnextafter(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nextafter(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} +int mpnextafterf(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nextafterf(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} +int mpnextafterl(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nextafterl(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} +int mpnexttoward(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nexttoward(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} +int mpnexttowardf(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nexttowardf(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} +int mpnexttowardl(struct t *t) { return mpnextafterl(t); } int mppow(struct t *t) { return mpd2(t, mpfr_pow); } int mppowf(struct t *t) { return mpf2(t, mpfr_pow); } int mppowl(struct t *t) { return mpl2(t, mpfr_pow); } @@ -538,8 +576,23 @@ int mpj0(struct t *t) { return mpd1(t, mpfr_j0); } int mpj1(struct t *t) { return mpd1(t, mpfr_j1); } int mpy0(struct t *t) { return mpd1(t, mpfr_y0); } int mpy1(struct t *t) { return mpd1(t, mpfr_y1); } -int mpscalb(struct t *t) { return -1; } -int mpscalbf(struct t *t) { return -1; } +// TODO: non standard functions +int mpscalb(struct t *t) +{ + setupfenv(t->r); + t->y = scalb(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; // wrong + return 0; +} +int mpscalbf(struct t *t) +{ + setupfenv(t->r); + t->y = scalbf(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; // wrong + return 0; +} int mpj0f(struct t *t) { return mpf1(t, mpfr_j0); } int mpj0l(struct t *t) { return mpl1(t, mpfr_j0); } int mpj1f(struct t *t) { return mpf1(t, mpfr_j1); } diff --git a/src/math/gen/mplibm.c b/src/math/gen/mplibm.c index 0546202..fffed54 100644 --- a/src/math/gen/mplibm.c +++ b/src/math/gen/mplibm.c @@ -150,6 +150,22 @@ int mpnearbyintl(struct t *t) { return mpl1(t, nearbyintl); } int mpnextafter(struct t *t) { return mpd2(t, nextafter); } int mpnextafterf(struct t *t) { return mpf2(t, nextafterf); } int mpnextafterl(struct t *t) { return mpl2(t, nextafterl); } +int mpnexttoward(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nexttoward(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} +int mpnexttowardf(struct t *t) +{ + feclearexcept(FE_ALL_EXCEPT); + t->y = nexttowardf(t->x, t->x2); + t->e = getexcept(); + t->dy = 0; + return 0; +} int mpnexttowardl(struct t *t) { return mpl2(t, nexttowardl); } int mppow(struct t *t) { return mpd2(t, pow); } int mppowf(struct t *t) { return mpf2(t, powf); } diff --git a/src/math/gen/template/ll_d.c b/src/math/gen/template/ll_d.c new file mode 100644 index 0000000..962cce4 --- /dev/null +++ b/src/math/gen/template/ll_d.c @@ -0,0 +1,45 @@ +#include +#include +#include "util.h" + +static struct ll_l t[] = { +#if LDBL_MANT_DIG == 53 +DHEADERS +#elif LDBL_MANT_DIG == 64 +HEADERS +#endif +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + long double y; + float d; + int e, i, err = 0; + struct ll_l *p; + + for (i = 0; i < sizeof t/sizeof *t; i++) { + p = t + i; + + if (p->r < 0) + continue; + fesetround(p->r); + feclearexcept(FE_ALL_EXCEPT); + y = ___(p->x, p->x2); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s ___(%La,%La)=%La, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperrl(y, p->y, p->dy); + if (!checkulp(d, p->r)) { + printf("%s:%d: %s ___(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/gen/template/ll_f.c b/src/math/gen/template/ll_f.c new file mode 100644 index 0000000..962cce4 --- /dev/null +++ b/src/math/gen/template/ll_f.c @@ -0,0 +1,45 @@ +#include +#include +#include "util.h" + +static struct ll_l t[] = { +#if LDBL_MANT_DIG == 53 +DHEADERS +#elif LDBL_MANT_DIG == 64 +HEADERS +#endif +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + long double y; + float d; + int e, i, err = 0; + struct ll_l *p; + + for (i = 0; i < sizeof t/sizeof *t; i++) { + p = t + i; + + if (p->r < 0) + continue; + fesetround(p->r); + feclearexcept(FE_ALL_EXCEPT); + y = ___(p->x, p->x2); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s ___(%La,%La)=%La, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperrl(y, p->y, p->dy); + if (!checkulp(d, p->r)) { + printf("%s:%d: %s ___(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/nextafter.c b/src/math/nextafter.c index 02c6edc..8c47fb5 100644 --- a/src/math/nextafter.c +++ b/src/math/nextafter.c @@ -3,6 +3,7 @@ #include "util.h" static struct dd_d t[] = { +#include "sanity/nextafter.h" }; diff --git a/src/math/nextafterf.c b/src/math/nextafterf.c index e0aae93..8a8033d 100644 --- a/src/math/nextafterf.c +++ b/src/math/nextafterf.c @@ -3,6 +3,7 @@ #include "util.h" static struct ff_f t[] = { +#include "sanity/nextafterf.h" }; diff --git a/src/math/nextafterl.c b/src/math/nextafterl.c index 23b94fd..2e9fc06 100644 --- a/src/math/nextafterl.c +++ b/src/math/nextafterl.c @@ -4,8 +4,10 @@ static struct ll_l t[] = { #if LDBL_MANT_DIG == 53 +#include "sanity/nextafter.h" #elif LDBL_MANT_DIG == 64 +#include "sanity/nextafterl.h" #endif }; diff --git a/src/math/nexttoward.c b/src/math/nexttoward.c new file mode 100644 index 0000000..9a87d00 --- /dev/null +++ b/src/math/nexttoward.c @@ -0,0 +1,47 @@ +#include +#include +#include "util.h" + +static struct ll_l t[] = { +#if LDBL_MANT_DIG == 53 +#include "sanity/nexttoward.h" + +#elif LDBL_MANT_DIG == 64 +#include "sanity/nexttoward.h" + +#endif +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + long double y; + float d; + int e, i, err = 0; + struct ll_l *p; + + for (i = 0; i < sizeof t/sizeof *t; i++) { + p = t + i; + + if (p->r < 0) + continue; + fesetround(p->r); + feclearexcept(FE_ALL_EXCEPT); + y = nexttoward(p->x, p->x2); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s nexttoward(%La,%La)=%La, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperrl(y, p->y, p->dy); + if (!checkulp(d, p->r)) { + printf("%s:%d: %s nexttoward(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/nexttowardf.c b/src/math/nexttowardf.c new file mode 100644 index 0000000..c402015 --- /dev/null +++ b/src/math/nexttowardf.c @@ -0,0 +1,47 @@ +#include +#include +#include "util.h" + +static struct ll_l t[] = { +#if LDBL_MANT_DIG == 53 +#include "sanity/nexttowardf.h" + +#elif LDBL_MANT_DIG == 64 +#include "sanity/nexttowardf.h" + +#endif +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + long double y; + float d; + int e, i, err = 0; + struct ll_l *p; + + for (i = 0; i < sizeof t/sizeof *t; i++) { + p = t + i; + + if (p->r < 0) + continue; + fesetround(p->r); + feclearexcept(FE_ALL_EXCEPT); + y = nexttowardf(p->x, p->x2); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s nexttowardf(%La,%La)=%La, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperrl(y, p->y, p->dy); + if (!checkulp(d, p->r)) { + printf("%s:%d: %s nexttowardf(%La,%La) want %La got %La ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/nexttowardl.c b/src/math/nexttowardl.c index f38c36e..5f28334 100644 --- a/src/math/nexttowardl.c +++ b/src/math/nexttowardl.c @@ -4,8 +4,10 @@ static struct ll_l t[] = { #if LDBL_MANT_DIG == 53 +#include "sanity/nexttoward.h" #elif LDBL_MANT_DIG == 64 +#include "sanity/nexttowardl.h" #endif }; diff --git a/src/math/sanity/nextafter.h b/src/math/sanity/nextafter.h new file mode 100644 index 0000000..96eb6e9 --- /dev/null +++ b/src/math/sanity/nextafter.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f1p+3, 0x1.22484b9ef31fp+2, -0x1.02239f3c6a8fp+3, 0x0p+0, 0) +T(RN, 0x1.161868e18bc67p+2, -0x1.1c6a6cdce75e8p+3, 0x1.161868e18bc66p+2, 0x0p+0, 0) +T(RN, -0x1.0c34b3e01e6e7p+3, -0x1.61bde29e83f6dp+1, -0x1.0c34b3e01e6e6p+3, 0x0p+0, 0) +T(RN, -0x1.a206f0a19dcc4p+2, 0x1.24527f7b576acp+2, -0x1.a206f0a19dcc3p+2, 0x0p+0, 0) +T(RN, 0x1.288bbb0d6a1e6p+3, 0x1.33edd910a3c01p+2, 0x1.288bbb0d6a1e5p+3, 0x0p+0, 0) +T(RN, -0x1.9ccd8be03f495p+2, 0x1.52fb12ef638a1p-1, -0x1.9ccd8be03f494p+2, 0x0p+0, 0) +T(RN, 0x1.f6f80ed2eab44p+2, 0x1.ab3ff8575b21dp-5, 0x1.f6f80ed2eab43p+2, 0x0p+0, 0) +T(RN, -0x1.95882b433fad3p-1, 0x1.eb4a2e7ce0693p+2, -0x1.95882b433fad2p-1, 0x0p+0, 0) +T(RN, 0x1.3b3d617ae3c4ap-1, 0x1.01860611d75e1p+1, 0x1.3b3d617ae3c4bp-1, 0x0p+0, 0) +T(RN, -0x1.1e159e36313eep-1, 0x1.081bd34224213p-5, -0x1.1e159e36313edp-1, 0x0p+0, 0) diff --git a/src/math/sanity/nextafterf.h b/src/math/sanity/nextafterf.h new file mode 100644 index 0000000..741b9b0 --- /dev/null +++ b/src/math/sanity/nextafterf.h @@ -0,0 +1,10 @@ +T(RN, -0x1.0223ap+3, 0x1.22484cp+2, -0x1.02239ep+3, 0x0p+0, 0) +T(RN, 0x1.161868p+2, -0x1.1c6a6cp+3, 0x1.161866p+2, 0x0p+0, 0) +T(RN, -0x1.0c34b4p+3, -0x1.61bde2p+1, -0x1.0c34b2p+3, 0x0p+0, 0) +T(RN, -0x1.a206fp+2, 0x1.24528p+2, -0x1.a206eep+2, 0x0p+0, 0) +T(RN, 0x1.288bbcp+3, 0x1.33eddap+2, 0x1.288bbap+3, 0x0p+0, 0) +T(RN, -0x1.9ccd8cp+2, 0x1.52fb12p-1, -0x1.9ccd8ap+2, 0x0p+0, 0) +T(RN, 0x1.f6f80ep+2, 0x1.ab3ff8p-5, 0x1.f6f80cp+2, 0x0p+0, 0) +T(RN, -0x1.95882cp-1, 0x1.eb4a2ep+2, -0x1.95882ap-1, 0x0p+0, 0) +T(RN, 0x1.3b3d62p-1, 0x1.018606p+1, 0x1.3b3d64p-1, 0x0p+0, 0) +T(RN, -0x1.1e159ep-1, 0x1.081bd4p-5, -0x1.1e159cp-1, 0x0p+0, 0) diff --git a/src/math/sanity/nextafterl.h b/src/math/sanity/nextafterl.h new file mode 100644 index 0000000..e84d062 --- /dev/null +++ b/src/math/sanity/nextafterl.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f13dep+3L, 0x1.22484b9ef31efd4p+2L, -0x1.02239f3c6a8f13dcp+3L, 0x0p+0, 0) +T(RN, 0x1.161868e18bc67782p+2L, -0x1.1c6a6cdce75e83acp+3L, 0x1.161868e18bc6778p+2L, 0x0p+0, 0) +T(RN, -0x1.0c34b3e01e6e682cp+3L, -0x1.61bde29e83f6cb16p+1L, -0x1.0c34b3e01e6e682ap+3L, 0x0p+0, 0) +T(RN, -0x1.a206f0a19dcc3948p+2L, 0x1.24527f7b576abb6p+2L, -0x1.a206f0a19dcc3946p+2L, 0x0p+0, 0) +T(RN, 0x1.288bbb0d6a1e5bdap+3L, 0x1.33edd910a3c00b7p+2L, 0x1.288bbb0d6a1e5bd8p+3L, 0x0p+0, 0) +T(RN, -0x1.9ccd8be03f4949a2p+2L, 0x1.52fb12ef638a1222p-1L, -0x1.9ccd8be03f4949ap+2L, 0x0p+0, 0) +T(RN, 0x1.f6f80ed2eab43b22p+2L, 0x1.ab3ff8575b21cf92p-5L, 0x1.f6f80ed2eab43b2p+2L, 0x0p+0, 0) +T(RN, -0x1.95882b433fad2dd4p-1L, 0x1.eb4a2e7ce06930dap+2L, -0x1.95882b433fad2dd2p-1L, 0x0p+0, 0) +T(RN, 0x1.3b3d617ae3c4a65p-1L, 0x1.01860611d75e1052p+1L, 0x1.3b3d617ae3c4a652p-1L, 0x0p+0, 0) +T(RN, -0x1.1e159e36313ee67cp-1L, 0x1.081bd34224212bp-5L, -0x1.1e159e36313ee67ap-1L, 0x0p+0, 0) diff --git a/src/math/sanity/nexttoward.h b/src/math/sanity/nexttoward.h new file mode 100644 index 0000000..8cf5f43 --- /dev/null +++ b/src/math/sanity/nexttoward.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f13dep+3L, 0x1.22484b9ef31efd4p+2L, -0x1.02239f3c6a8fp+3, 0x0p+0, INEXACT) +T(RN, 0x1.161868e18bc67782p+2L, -0x1.1c6a6cdce75e83acp+3L, 0x1.161868e18bc66p+2, 0x0p+0, INEXACT) +T(RN, -0x1.0c34b3e01e6e682cp+3L, -0x1.61bde29e83f6cb16p+1L, -0x1.0c34b3e01e6e6p+3, 0x0p+0, INEXACT) +T(RN, -0x1.a206f0a19dcc3948p+2L, 0x1.24527f7b576abb6p+2L, -0x1.a206f0a19dcc3p+2, 0x0p+0, INEXACT) +T(RN, 0x1.288bbb0d6a1e5bdap+3L, 0x1.33edd910a3c00b7p+2L, 0x1.288bbb0d6a1e5p+3, 0x0p+0, INEXACT) +T(RN, -0x1.9ccd8be03f4949a2p+2L, 0x1.52fb12ef638a1222p-1L, -0x1.9ccd8be03f494p+2, 0x0p+0, INEXACT) +T(RN, 0x1.f6f80ed2eab43b22p+2L, 0x1.ab3ff8575b21cf92p-5L, 0x1.f6f80ed2eab43p+2, 0x0p+0, INEXACT) +T(RN, -0x1.95882b433fad2dd4p-1L, 0x1.eb4a2e7ce06930dap+2L, -0x1.95882b433fad2p-1, 0x0p+0, INEXACT) +T(RN, 0x1.3b3d617ae3c4a65p-1L, 0x1.01860611d75e1052p+1L, 0x1.3b3d617ae3c4bp-1, 0x0p+0, INEXACT) +T(RN, -0x1.1e159e36313ee67cp-1L, 0x1.081bd34224212bp-5L, -0x1.1e159e36313edp-1, 0x0p+0, INEXACT) diff --git a/src/math/sanity/nexttowardf.h b/src/math/sanity/nexttowardf.h new file mode 100644 index 0000000..a403d33 --- /dev/null +++ b/src/math/sanity/nexttowardf.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f13dep+3L, 0x1.22484b9ef31efd4p+2L, -0x1.02239ep+3, 0x0p+0, INEXACT) +T(RN, 0x1.161868e18bc67782p+2L, -0x1.1c6a6cdce75e83acp+3L, 0x1.161866p+2, 0x0p+0, INEXACT) +T(RN, -0x1.0c34b3e01e6e682cp+3L, -0x1.61bde29e83f6cb16p+1L, -0x1.0c34b2p+3, 0x0p+0, INEXACT) +T(RN, -0x1.a206f0a19dcc3948p+2L, 0x1.24527f7b576abb6p+2L, -0x1.a206eep+2, 0x0p+0, INEXACT) +T(RN, 0x1.288bbb0d6a1e5bdap+3L, 0x1.33edd910a3c00b7p+2L, 0x1.288bbap+3, 0x0p+0, INEXACT) +T(RN, -0x1.9ccd8be03f4949a2p+2L, 0x1.52fb12ef638a1222p-1L, -0x1.9ccd8ap+2, 0x0p+0, INEXACT) +T(RN, 0x1.f6f80ed2eab43b22p+2L, 0x1.ab3ff8575b21cf92p-5L, 0x1.f6f80cp+2, 0x0p+0, INEXACT) +T(RN, -0x1.95882b433fad2dd4p-1L, 0x1.eb4a2e7ce06930dap+2L, -0x1.95882ap-1, 0x0p+0, INEXACT) +T(RN, 0x1.3b3d617ae3c4a65p-1L, 0x1.01860611d75e1052p+1L, 0x1.3b3d64p-1, 0x0p+0, INEXACT) +T(RN, -0x1.1e159e36313ee67cp-1L, 0x1.081bd34224212bp-5L, -0x1.1e159cp-1, 0x0p+0, INEXACT) diff --git a/src/math/sanity/nexttowardl.h b/src/math/sanity/nexttowardl.h new file mode 100644 index 0000000..e84d062 --- /dev/null +++ b/src/math/sanity/nexttowardl.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f13dep+3L, 0x1.22484b9ef31efd4p+2L, -0x1.02239f3c6a8f13dcp+3L, 0x0p+0, 0) +T(RN, 0x1.161868e18bc67782p+2L, -0x1.1c6a6cdce75e83acp+3L, 0x1.161868e18bc6778p+2L, 0x0p+0, 0) +T(RN, -0x1.0c34b3e01e6e682cp+3L, -0x1.61bde29e83f6cb16p+1L, -0x1.0c34b3e01e6e682ap+3L, 0x0p+0, 0) +T(RN, -0x1.a206f0a19dcc3948p+2L, 0x1.24527f7b576abb6p+2L, -0x1.a206f0a19dcc3946p+2L, 0x0p+0, 0) +T(RN, 0x1.288bbb0d6a1e5bdap+3L, 0x1.33edd910a3c00b7p+2L, 0x1.288bbb0d6a1e5bd8p+3L, 0x0p+0, 0) +T(RN, -0x1.9ccd8be03f4949a2p+2L, 0x1.52fb12ef638a1222p-1L, -0x1.9ccd8be03f4949ap+2L, 0x0p+0, 0) +T(RN, 0x1.f6f80ed2eab43b22p+2L, 0x1.ab3ff8575b21cf92p-5L, 0x1.f6f80ed2eab43b2p+2L, 0x0p+0, 0) +T(RN, -0x1.95882b433fad2dd4p-1L, 0x1.eb4a2e7ce06930dap+2L, -0x1.95882b433fad2dd2p-1L, 0x0p+0, 0) +T(RN, 0x1.3b3d617ae3c4a65p-1L, 0x1.01860611d75e1052p+1L, 0x1.3b3d617ae3c4a652p-1L, 0x0p+0, 0) +T(RN, -0x1.1e159e36313ee67cp-1L, 0x1.081bd34224212bp-5L, -0x1.1e159e36313ee67ap-1L, 0x0p+0, 0) diff --git a/src/math/sanity/scalb.h b/src/math/sanity/scalb.h new file mode 100644 index 0000000..a964794 --- /dev/null +++ b/src/math/sanity/scalb.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f1p+3, 0x1.22484b9ef31fp+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.161868e18bc67p+2, -0x1.1c6a6cdce75e8p+3, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.0c34b3e01e6e7p+3, -0x1.61bde29e83f6dp+1, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.a206f0a19dcc4p+2, 0x1.24527f7b576acp+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.288bbb0d6a1e6p+3, 0x1.33edd910a3c01p+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.9ccd8be03f495p+2, 0x1.52fb12ef638a1p-1, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.f6f80ed2eab44p+2, 0x1.ab3ff8575b21dp-5, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.95882b433fad3p-1, 0x1.eb4a2e7ce0693p+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.3b3d617ae3c4ap-1, 0x1.01860611d75e1p+1, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.1e159e36313eep-1, 0x1.081bd34224213p-5, nan, 0x0p+0, INEXACT|INVALID) diff --git a/src/math/sanity/scalbf.h b/src/math/sanity/scalbf.h new file mode 100644 index 0000000..caf8170 --- /dev/null +++ b/src/math/sanity/scalbf.h @@ -0,0 +1,10 @@ +T(RN, -0x1.0223ap+3, 0x1.22484cp+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.161868p+2, -0x1.1c6a6cp+3, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.0c34b4p+3, -0x1.61bde2p+1, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.a206fp+2, 0x1.24528p+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.288bbcp+3, 0x1.33eddap+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.9ccd8cp+2, 0x1.52fb12p-1, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.f6f80ep+2, 0x1.ab3ff8p-5, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.95882cp-1, 0x1.eb4a2ep+2, nan, 0x0p+0, INEXACT|INVALID) +T(RN, 0x1.3b3d62p-1, 0x1.018606p+1, nan, 0x0p+0, INEXACT|INVALID) +T(RN, -0x1.1e159ep-1, 0x1.081bd4p-5, nan, 0x0p+0, INEXACT|INVALID) diff --git a/src/math/scalb.c b/src/math/scalb.c index 88b529b..35ef2ce 100644 --- a/src/math/scalb.c +++ b/src/math/scalb.c @@ -3,6 +3,7 @@ #include "util.h" static struct dd_d t[] = { +#include "sanity/scalb.h" }; diff --git a/src/math/scalbf.c b/src/math/scalbf.c index d91dff4..233c14d 100644 --- a/src/math/scalbf.c +++ b/src/math/scalbf.c @@ -3,6 +3,7 @@ #include "util.h" static struct ff_f t[] = { +#include "sanity/scalbf.h" }; -- 2.20.1