From 588927eced2aa02855723750217fe3fc26404da9 Mon Sep 17 00:00:00 2001 From: nsz Date: Sat, 13 Oct 2012 18:12:15 +0200 Subject: [PATCH 1/1] math: add remquo and fma --- src/math/fma.c | 41 +++++++++++++++++ src/math/fmaf.c | 41 +++++++++++++++++ src/math/fmal.c | 45 +++++++++++++++++++ src/math/gen/functions.h | 13 ++++++ src/math/gen/gensanity.sh | 8 ++++ src/math/gen/mp.c | 93 +++++++++++++++++++++++++++++++++++++++ src/math/gen/mplibm.c | 65 ++++++++++++++++++++------- src/math/remquo.c | 42 ++++++++++++++++++ src/math/remquof.c | 42 ++++++++++++++++++ src/math/remquol.c | 42 ++++++++++++++++++ src/math/sanity/fma.h | 5 +++ src/math/sanity/fmaf.h | 5 +++ src/math/sanity/fmal.h | 5 +++ src/math/sanity/remquo.h | 10 +++++ src/math/sanity/remquof.h | 10 +++++ src/math/sanity/remquol.h | 10 +++++ src/math/util.h | 6 +++ 17 files changed, 466 insertions(+), 17 deletions(-) create mode 100644 src/math/fma.c create mode 100644 src/math/fmaf.c create mode 100644 src/math/fmal.c create mode 100644 src/math/remquo.c create mode 100644 src/math/remquof.c create mode 100644 src/math/remquol.c create mode 100644 src/math/sanity/fma.h create mode 100644 src/math/sanity/fmaf.h create mode 100644 src/math/sanity/fmal.h create mode 100644 src/math/sanity/remquo.h create mode 100644 src/math/sanity/remquof.h create mode 100644 src/math/sanity/remquol.h diff --git a/src/math/fma.c b/src/math/fma.c new file mode 100644 index 0000000..4a353f9 --- /dev/null +++ b/src/math/fma.c @@ -0,0 +1,41 @@ +#include +#include +#include "util.h" + +static struct ddd_d t[] = { +#include "sanity/fma.h" +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + double y; + float d; + int e, i, err = 0; + struct ddd_d *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 = fma(p->x, p->x2, p->x3); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s fma(%a,%a,%a)=%a, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperr(y, p->y, p->dy); + if (!checkulp(d, p->r)) { + printf("%s:%d: %s fma(%a,%a,%a) want %a got %a ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/fmaf.c b/src/math/fmaf.c new file mode 100644 index 0000000..20fdb02 --- /dev/null +++ b/src/math/fmaf.c @@ -0,0 +1,41 @@ +#include +#include +#include "util.h" + +static struct fff_f t[] = { +#include "sanity/fmaf.h" +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + float y; + float d; + int e, i, err = 0; + struct fff_f *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 = fmaf(p->x, p->x2, p->x3); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s fmaf(%a,%a,%a)=%a, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperrf(y, p->y, p->dy); + if (!checkulp(d, p->r)) { + printf("%s:%d: %s fmaf(%a,%a,%a) want %a got %a ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/fmal.c b/src/math/fmal.c new file mode 100644 index 0000000..801a7a3 --- /dev/null +++ b/src/math/fmal.c @@ -0,0 +1,45 @@ +#include +#include +#include "util.h" + +static struct lll_l t[] = { +#if LDBL_MANT_DIG == 53 +#include "sanity/fma.h" +#elif LDBL_MANT_DIG == 64 +#include "sanity/fmal.h" +#endif +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + long double y; + float d; + int e, i, err = 0; + struct lll_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 = fmal(p->x, p->x2, p->x3); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s fmal(%La,%La,%La)=%La, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, 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 fmal(%La,%La,%La) want %La got %La ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->x3, p->y, y, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/gen/functions.h b/src/math/gen/functions.h index 8cff966..bbc4864 100644 --- a/src/math/gen/functions.h +++ b/src/math/gen/functions.h @@ -143,9 +143,11 @@ T(exp10l, l_l) T(pow10, d_d) T(pow10f, f_f) T(pow10l, l_l) + T(frexp, d_di) T(frexpf, f_fi) T(frexpl, l_li) + T(ldexp, di_d) T(ldexpf, fi_f) T(ldexpl, li_l) @@ -155,12 +157,14 @@ T(scalbnl, li_l) T(scalbln, di_d) T(scalblnf, fi_f) T(scalblnl, li_l) + T(lgamma, d_di) T(lgammaf, f_fi) T(lgammal, l_li) T(lgamma_r, d_di) T(lgammaf_r, f_fi) T(lgammal_r, l_li) + T(ilogb, d_i) T(ilogbf, f_i) T(ilogbl, l_i) @@ -176,6 +180,7 @@ T(llroundl, l_i) T(lround, d_i) T(lroundf, f_i) T(lroundl, l_i) + T(modf, d_dd) T(modff, f_ff) T(modfl, l_ll) @@ -183,3 +188,11 @@ T(sincos, d_dd) T(sincosf, f_ff) T(sincosl, l_ll) +T(remquo, dd_di) +T(remquof, ff_fi) +T(remquol, ll_li) + +T(fma, ddd_d) +T(fmaf, fff_f) +T(fmal, lll_l) + diff --git a/src/math/gen/gensanity.sh b/src/math/gen/gensanity.sh index 31bb996..50ad2f9 100755 --- a/src/math/gen/gensanity.sh +++ b/src/math/gen/gensanity.sh @@ -44,6 +44,14 @@ EOF -0.79205451198489594412029014134600873 +7.67640268511754002832536318951411755 +0.61570267319792408792325107549103713 +2.01190257903248027376896111888376742 -0.55875868236091523814033056701077708 +0.03223983060263803856752696457418850 +EOF + ;; + ddd_*|fff_*|lll_*) ./gen $N >$D/$N.h <i = mpremquo_q, 0); } +int mpremquof(struct t *t) { return mpf2(t, wrap_remquo) || (t->i = mpremquo_q, 0); } +int mpremquol(struct t *t) { return mpl2(t, wrap_remquo) || (t->i = mpremquo_q, 0); } + +int mpfma(struct t *t) +{ + int tn; + int r = rmap(t->r); + MPFR_DECL_INIT(mx, 53); + MPFR_DECL_INIT(mx2, 53); + MPFR_DECL_INIT(mx3, 53); + MPFR_DECL_INIT(my, 128); + + mpsetup(); + mpfr_clear_flags(); + mpfr_set_d(mx, t->x, MPFR_RNDN); + mpfr_set_d(mx2, t->x2, MPFR_RNDN); + mpfr_set_d(mx3, t->x3, MPFR_RNDN); + tn = mpfr_fma(my, mx, mx2, mx3, r); + gend(t, my, tn, r); + if ((t->e & INEXACT) && nextafter(t->y, 0) == 0) { + mpfr_set_emin(-(1<<20)); + tn = mpfr_fma(my, mx, mx2, mx3, r); + mpfr_mul_2si(my, my, 1074, MPFR_RNDN); + t->dy = scalbnl(t->y, 1074) - mpfr_get_ld(my, r); + mpfr_set_emin(-1073); + } + return 0; +} + +int mpfmaf(struct t *t) +{ + int tn; + int r = rmap(t->r); + MPFR_DECL_INIT(mx, 24); + MPFR_DECL_INIT(mx2, 24); + MPFR_DECL_INIT(mx3, 24); + MPFR_DECL_INIT(my, 128); + + mpsetupf(); + mpfr_clear_flags(); + mpfr_set_flt(mx, t->x, MPFR_RNDN); + mpfr_set_flt(mx2, t->x2, MPFR_RNDN); + mpfr_set_flt(mx3, t->x3, MPFR_RNDN); + tn = mpfr_fma(my, mx, mx2, mx3, r); + genf(t, my, tn, r); + if ((t->e & INEXACT) && nextafterf(t->y, 0) == 0) { + mpfr_set_emin(-(1<<20)); + tn = mpfr_fma(my, mx, mx2, mx3, r); + mpfr_mul_2si(my, my, 149, MPFR_RNDN); + t->dy = scalbnl(t->y, 149) - mpfr_get_ld(my, r); + mpfr_set_emin(-148); + } + return 0; +} + +int mpfmal(struct t *t) +{ +#if LDBL_MANT_DIG == 53 + return mpfma(t); +#elif LDBL_MANT_DIG == 64 + int tn; + int r = rmap(t->r); + MPFR_DECL_INIT(mx, 64); + MPFR_DECL_INIT(mx2, 64); + MPFR_DECL_INIT(mx3, 64); + MPFR_DECL_INIT(my, 128); + + mpsetupl(); + mpfr_clear_flags(); + mpfr_set_ld(mx, t->x, MPFR_RNDN); + mpfr_set_ld(mx2, t->x2, MPFR_RNDN); + mpfr_set_ld(mx3, t->x3, MPFR_RNDN); + tn = mpfr_fma(my, mx, mx2, mx3, r); + genl(t, my, tn, r); + if ((t->e & INEXACT) && nextafterl(t->y, 0) == 0) { + mpfr_set_emin(-(1<<20)); + tn = mpfr_fma(my, mx, mx2, mx3, r); + mpfr_mul_2si(my, my, 16445, MPFR_RNDN); + t->dy = scalbnl(t->y, 16445) - mpfr_get_ld(my, r); + mpfr_set_emin(-16444); + } + return 0; +#else + return -1; +#endif +} + diff --git a/src/math/gen/mplibm.c b/src/math/gen/mplibm.c index 62b8721..cf17d6d 100644 --- a/src/math/gen/mplibm.c +++ b/src/math/gen/mplibm.c @@ -219,7 +219,7 @@ int mppow10(struct t *t) { return mpd1(t, pow10); } int mppow10f(struct t *t) { return mpf1(t, pow10f); } int mppow10l(struct t *t) { return mpl1(t, pow10l); } -#define mp_f_fi(n) \ +#define mp_fi_f(n) \ int mp##n(struct t *t) \ { \ t->dy = 0; \ @@ -229,17 +229,17 @@ int mp##n(struct t *t) \ return 0; \ } -mp_f_fi(ldexp) -mp_f_fi(ldexpf) -mp_f_fi(ldexpl) -mp_f_fi(scalbn) -mp_f_fi(scalbnf) -mp_f_fi(scalbnl) -mp_f_fi(scalbln) -mp_f_fi(scalblnf) -mp_f_fi(scalblnl) +mp_fi_f(ldexp) +mp_fi_f(ldexpf) +mp_fi_f(ldexpl) +mp_fi_f(scalbn) +mp_fi_f(scalbnf) +mp_fi_f(scalbnl) +mp_fi_f(scalbln) +mp_fi_f(scalblnf) +mp_fi_f(scalblnl) -#define mp_fi_f(n) \ +#define mp_f_fi(n) \ int mp##n(struct t *t) \ { \ int i; \ @@ -251,12 +251,12 @@ int mp##n(struct t *t) \ return 0; \ } -mp_fi_f(frexp) -mp_fi_f(frexpf) -mp_fi_f(frexpl) -mp_fi_f(lgamma_r) -mp_fi_f(lgammaf_r) -mp_fi_f(lgammal_r) +mp_f_fi(frexp) +mp_f_fi(frexpf) +mp_f_fi(frexpl) +mp_f_fi(lgamma_r) +mp_f_fi(lgammaf_r) +mp_f_fi(lgammal_r) int mplgamma(struct t *t) { @@ -380,3 +380,34 @@ int mpsincosl(struct t *t) t->e = getexcept(); return 0; } + +#define mp_ff_fi(n) \ +int mp##n(struct t *t) \ +{ \ + int i; \ + t->dy = 0; \ + setupfenv(t->r); \ + t->y = n(t->x, t->x2, &i); \ + t->e = getexcept(); \ + t->i = i; \ + return 0; \ +} + +mp_ff_fi(remquo) +mp_ff_fi(remquof) +mp_ff_fi(remquol) + +#define mp_fff_f(n) \ +int mp##n(struct t *t) \ +{ \ + t->dy = 0; \ + setupfenv(t->r); \ + t->y = n(t->x, t->x2, t->x3); \ + t->e = getexcept(); \ + return 0; \ +} + +mp_fff_f(fma) +mp_fff_f(fmaf) +mp_fff_f(fmal) + diff --git a/src/math/remquo.c b/src/math/remquo.c new file mode 100644 index 0000000..64022f1 --- /dev/null +++ b/src/math/remquo.c @@ -0,0 +1,42 @@ +#include +#include +#include "util.h" + +static struct dd_di t[] = { +#include "sanity/remquo.h" +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + int yi; + double y; + float d; + int e, i, err = 0; + struct dd_di *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 = remquo(p->x, p->x2, &yi); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s remquo(%a,%a)=%a,%lld, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperr(y, p->y, p->dy); + if (!checkulp(d, p->r) || (yi & 7) != (p->i & 7) || (yi < 0) != (p->i < 0)) { + printf("%s:%d: %s remquo(%a,%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, y, yi, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/remquof.c b/src/math/remquof.c new file mode 100644 index 0000000..72f4d5b --- /dev/null +++ b/src/math/remquof.c @@ -0,0 +1,42 @@ +#include +#include +#include "util.h" + +static struct ff_fi t[] = { +#include "sanity/remquof.h" +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + int yi; + float y; + float d; + int e, i, err = 0; + struct ff_fi *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 = remquof(p->x, p->x2, &yi); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s remquof(%a,%a)=%a,%lld, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperr(y, p->y, p->dy); + if (!checkulp(d, p->r) || (yi & 7) != (p->i & 7) || (yi < 0) != (p->i < 0)) { + printf("%s:%d: %s remquof(%a,%a) want %a,%lld got %a,%d ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, y, yi, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/remquol.c b/src/math/remquol.c new file mode 100644 index 0000000..a06497d --- /dev/null +++ b/src/math/remquol.c @@ -0,0 +1,42 @@ +#include +#include +#include "util.h" + +static struct ll_li t[] = { +#include "sanity/remquol.h" +}; + +int main(void) +{ + #pragma STDC FENV_ACCESS ON + int yi; + long double y; + float d; + int e, i, err = 0; + struct ll_li *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 = remquol(p->x, p->x2, &yi); + e = fetestexcept(INEXACT|INVALID|DIVBYZERO|UNDERFLOW|OVERFLOW); + + if (!checkexcept(e, p->e, p->r)) { + printf("%s:%d: bad fp exception: %s remquol(%La,%La)=%La,%lld, want %s", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, estr(p->e)); + printf(" got %s\n", estr(e)); + err++; + } + d = ulperr(y, p->y, p->dy); + if (!checkulp(d, p->r) || (yi & 7) != (p->i & 7) || (yi < 0) != (p->i < 0)) { + printf("%s:%d: %s remquol(%La,%La) want %La,%lld got %La,%d ulperr %.3f = %a + %a\n", + p->file, p->line, rstr(p->r), p->x, p->x2, p->y, p->i, y, yi, d, d-p->dy, p->dy); + err++; + } + } + return !!err; +} diff --git a/src/math/sanity/fma.h b/src/math/sanity/fma.h new file mode 100644 index 0000000..0b9831d --- /dev/null +++ b/src/math/sanity/fma.h @@ -0,0 +1,5 @@ +T(RN, -0x1.02239f3c6a8f1p+3, 0x1.22484b9ef31fp+2, 0x1.52fb12ef638a1p-1, -0x1.1f69545c32effp+5, -0x1.759846p-3, INEXACT) +T(RN, 0x1.161868e18bc67p+2, -0x1.1c6a6cdce75e8p+3, 0x1.ab3ff8575b21dp-5, -0x1.348be0b9d32d3p+5, 0x1.b43916p-3, INEXACT) +T(RN, -0x1.0c34b3e01e6e7p+3, -0x1.61bde29e83f6dp+1, 0x1.eb4a2e7ce0693p+2, 0x1.ed6e27fca81b7p+4, -0x1.f11488p-2, INEXACT) +T(RN, -0x1.a206f0a19dcc4p+2, 0x1.24527f7b576acp+2, -0x1.95882b433fad3p-1, -0x1.ea02e2365f336p+4, 0x1.41da3ap-2, INEXACT) +T(RN, 0x1.288bbb0d6a1e6p+3, 0x1.33edd910a3c01p+2, -0x1.1e159e36313eep-1, 0x1.603abfa620e23p+5, -0x1.7be8ccp-3, INEXACT) diff --git a/src/math/sanity/fmaf.h b/src/math/sanity/fmaf.h new file mode 100644 index 0000000..a402ac3 --- /dev/null +++ b/src/math/sanity/fmaf.h @@ -0,0 +1,5 @@ +T(RN, -0x1.0223ap+3, 0x1.22484cp+2, 0x1.52fb12p-1, -0x1.1f6956p+5, -0x1.81b2p-3, INEXACT) +T(RN, 0x1.161868p+2, -0x1.1c6a6cp+3, 0x1.ab3ff8p-5, -0x1.348bdep+5, 0x1.9eb7cp-2, INEXACT) +T(RN, -0x1.0c34b4p+3, -0x1.61bde2p+1, 0x1.eb4a2ep+2, 0x1.ed6e28p+4, 0x1.392a3p-2, INEXACT) +T(RN, -0x1.a206fp+2, 0x1.24528p+2, -0x1.95882cp-1, -0x1.ea02e2p+4, 0x1.716p-3, INEXACT) +T(RN, 0x1.288bbcp+3, 0x1.33eddap+2, -0x1.1e159ep-1, 0x1.603ac2p+5, 0x1.ff5e8p-5, INEXACT) diff --git a/src/math/sanity/fmal.h b/src/math/sanity/fmal.h new file mode 100644 index 0000000..4860f95 --- /dev/null +++ b/src/math/sanity/fmal.h @@ -0,0 +1,5 @@ +T(RN, -0x1.02239f3c6a8f13dep+3L, 0x1.22484b9ef31efd4p+2L, 0x1.52fb12ef638a1222p-1L, -0x1.1f69545c32efeea8p+5L, 0x1.f2223cp-2, INEXACT) +T(RN, 0x1.161868e18bc67782p+2L, -0x1.1c6a6cdce75e83acp+3L, 0x1.ab3ff8575b21cf92p-5L, -0x1.348be0b9d32d3fbep+5L, -0x1.f35e54p-2, INEXACT) +T(RN, -0x1.0c34b3e01e6e682cp+3L, -0x1.61bde29e83f6cb16p+1L, 0x1.eb4a2e7ce06930dap+2L, 0x1.ed6e27fca81b6804p+4L, 0x1.2d3bc8p-3, INEXACT) +T(RN, -0x1.a206f0a19dcc3948p+2L, 0x1.24527f7b576abb6p+2L, -0x1.95882b433fad2dd4p-1L, -0x1.ea02e2365f3355bcp+4L, 0x1.3d0c8cp-2, INEXACT) +T(RN, 0x1.288bbb0d6a1e5bdap+3L, 0x1.33edd910a3c00b7p+2L, -0x1.1e159e36313ee67cp-1L, 0x1.603abfa620e22898p+5L, 0x1.114048p-2, INEXACT) diff --git a/src/math/sanity/remquo.h b/src/math/sanity/remquo.h new file mode 100644 index 0000000..0f249ec --- /dev/null +++ b/src/math/sanity/remquo.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f1p+3, 0x1.22484b9ef31fp+2, 0x1.01256314447f8p+0, 0x0p+0, -2, 0) +T(RN, 0x1.161868e18bc67p+2, -0x1.1c6a6cdce75e8p+3, 0x1.161868e18bc67p+2, 0x0p+0, 0, 0) +T(RN, -0x1.0c34b3e01e6e7p+3, -0x1.61bde29e83f6dp+1, -0x1.7324f49dbaaap-4, 0x0p+0, 3, 0) +T(RN, -0x1.a206f0a19dcc4p+2, 0x1.24527f7b576acp+2, -0x1.f6d1c4991986p+0, 0x0p+0, -1, 0) +T(RN, 0x1.288bbb0d6a1e6p+3, 0x1.33edd910a3c01p+2, -0x1.6c43c0673436p-2, 0x0p+0, 2, 0) +T(RN, -0x1.9ccd8be03f495p+2, 0x1.52fb12ef638a1p-1, 0x1.5d89795fa4688p-3, 0x0p+0, -10, 0) +T(RN, 0x1.f6f80ed2eab44p+2, 0x1.ab3ff8575b21dp-5, -0x1.0d682422cda36p-6, 0x0p+0, 151, 0) +T(RN, -0x1.95882b433fad3p-1, 0x1.eb4a2e7ce0693p+2, -0x1.95882b433fad3p-1, 0x0p+0, 0, 0) +T(RN, 0x1.3b3d617ae3c4ap-1, 0x1.01860611d75e1p+1, 0x1.3b3d617ae3c4ap-1, 0x0p+0, 0, 0) +T(RN, -0x1.1e159e36313eep-1, 0x1.081bd34224213p-5, -0x1.5e036ffab6e74p-7, 0x0p+0, -17, 0) diff --git a/src/math/sanity/remquof.h b/src/math/sanity/remquof.h new file mode 100644 index 0000000..163fdf0 --- /dev/null +++ b/src/math/sanity/remquof.h @@ -0,0 +1,10 @@ +T(RN, -0x1.0223ap+3, 0x1.22484cp+2, 0x1.01256p+0, 0x0p+0, -2, 0) +T(RN, 0x1.161868p+2, -0x1.1c6a6cp+3, 0x1.161868p+2, 0x0p+0, 0, 0) +T(RN, -0x1.0c34b4p+3, -0x1.61bde2p+1, -0x1.73254p-4, 0x0p+0, 3, 0) +T(RN, -0x1.a206fp+2, 0x1.24528p+2, -0x1.f6d1cp+0, 0x0p+0, -1, 0) +T(RN, 0x1.288bbcp+3, 0x1.33eddap+2, -0x1.6c43cp-2, 0x0p+0, 2, 0) +T(RN, -0x1.9ccd8cp+2, 0x1.52fb12p-1, 0x1.5d895p-3, 0x0p+0, -10, 0) +T(RN, 0x1.f6f80ep+2, 0x1.ab3ff8p-5, -0x1.0d689p-6, 0x0p+0, 151, 0) +T(RN, -0x1.95882cp-1, 0x1.eb4a2ep+2, -0x1.95882cp-1, 0x0p+0, 0, 0) +T(RN, 0x1.3b3d62p-1, 0x1.018606p+1, 0x1.3b3d62p-1, 0x0p+0, 0, 0) +T(RN, -0x1.1e159ep-1, 0x1.081bd4p-5, -0x1.5e033p-7, 0x0p+0, -17, 0) diff --git a/src/math/sanity/remquol.h b/src/math/sanity/remquol.h new file mode 100644 index 0000000..2c61219 --- /dev/null +++ b/src/math/sanity/remquol.h @@ -0,0 +1,10 @@ +T(RN, -0x1.02239f3c6a8f13dep+3L, 0x1.22484b9ef31efd4p+2L, 0x1.01256314447f4b1p+0L, 0x0p+0, -2, 0) +T(RN, 0x1.161868e18bc67782p+2L, -0x1.1c6a6cdce75e83acp+3L, 0x1.161868e18bc67782p+2L, 0x0p+0, 0, 0) +T(RN, -0x1.0c34b3e01e6e682cp+3L, -0x1.61bde29e83f6cb16p+1L, -0x1.7324f49dbaa7edcp-4L, 0x0p+0, 3, 0) +T(RN, -0x1.a206f0a19dcc3948p+2L, 0x1.24527f7b576abb6p+2L, -0x1.f6d1c4991985f7ap+0L, 0x0p+0, -1, 0) +T(RN, 0x1.288bbb0d6a1e5bdap+3L, 0x1.33edd910a3c00b7p+2L, -0x1.6c43c0673435f2cp-2L, 0x0p+0, 2, 0) +T(RN, -0x1.9ccd8be03f4949a2p+2L, 0x1.52fb12ef638a1222p-1L, 0x1.5d89795fa469a11p-3L, 0x0p+0, -10, 0) +T(RN, 0x1.f6f80ed2eab43b22p+2L, 0x1.ab3ff8575b21cf92p-5L, -0x1.0d682422cda7bc3cp-6L, 0x0p+0, 151, 0) +T(RN, -0x1.95882b433fad2dd4p-1L, 0x1.eb4a2e7ce06930dap+2L, -0x1.95882b433fad2dd4p-1L, 0x0p+0, 0, 0) +T(RN, 0x1.3b3d617ae3c4a65p-1L, 0x1.01860611d75e1052p+1L, 0x1.3b3d617ae3c4a65p-1L, 0x0p+0, 0, 0) +T(RN, -0x1.1e159e36313ee67cp-1L, 0x1.081bd34224212bp-5L, -0x1.5e036ffab6ea33p-7L, 0x0p+0, -17, 0) diff --git a/src/math/util.h b/src/math/util.h index 1fc6939..875203b 100644 --- a/src/math/util.h +++ b/src/math/util.h @@ -84,6 +84,12 @@ struct l_i {POS int r; long double x; long long i; int e; }; struct d_dd {POS int r; double x; double y; float dy; double y2; float dy2; int e; }; struct f_ff {POS int r; float x; float y; float dy; float y2; float dy2; int e; }; struct l_ll {POS int r; long double x; long double y; float dy; long double y2; float dy2; int e; }; +struct ff_fi {POS int r; float x; float x2; float y; float dy; long long i; int e; }; +struct dd_di {POS int r; double x; double x2; double y; float dy; long long i; int e; }; +struct ll_li {POS int r; long double x; long double x2; long double y; float dy; long long i; int e; }; +struct fff_f {POS int r; float x; float x2; float x3; float y; float dy; int e; }; +struct ddd_d {POS int r; double x; double x2; double x3; double y; float dy; int e; }; +struct lll_l {POS int r; long double x; long double x2; long double x3; long double y; float dy; int e; }; #undef POS char *estr(int); -- 2.20.1