math: add nextafter*, nextoward* and scalb to gen
authornsz <nsz@port70.net>
Sat, 13 Oct 2012 13:17:51 +0000 (15:17 +0200)
committernsz <nsz@port70.net>
Sat, 13 Oct 2012 13:17:51 +0000 (15:17 +0200)
22 files changed:
src/math/gen/functions.h
src/math/gen/gensanity.sh [new file with mode: 0755]
src/math/gen/mp.c
src/math/gen/mplibm.c
src/math/gen/template/ll_d.c [new file with mode: 0644]
src/math/gen/template/ll_f.c [new file with mode: 0644]
src/math/nextafter.c
src/math/nextafterf.c
src/math/nextafterl.c
src/math/nexttoward.c [new file with mode: 0644]
src/math/nexttowardf.c [new file with mode: 0644]
src/math/nexttowardl.c
src/math/sanity/nextafter.h [new file with mode: 0644]
src/math/sanity/nextafterf.h [new file with mode: 0644]
src/math/sanity/nextafterl.h [new file with mode: 0644]
src/math/sanity/nexttoward.h [new file with mode: 0644]
src/math/sanity/nexttowardf.h [new file with mode: 0644]
src/math/sanity/nexttowardl.h [new file with mode: 0644]
src/math/sanity/scalb.h [new file with mode: 0644]
src/math/sanity/scalbf.h [new file with mode: 0644]
src/math/scalb.c
src/math/scalbf.c

index c13a166..bdf0be8 100644 (file)
@@ -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 (executable)
index 0000000..3577059
--- /dev/null
@@ -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 <<EOF
+-8.06684839057968126823036836721962107
++4.34523984933830528860918339265097582
+-8.38143342755524846875570469976848365
+-6.53167358191348375502677177380274565
++9.26705696697258528046907106996633473
++0.66198589809950443806520229507072615
+-0.40660392238535529519351490505650392
++0.56175974622072409170769641066459813
++0.77415229659130372834006997382367211
+-0.67876370263940246316802166606111153
+EOF
+       ;;
+       di_*|fi_*|li_*) ./gen $N >$D/$N.h <<EOF
+-8.06684839057968126823036836721962107 -2
++4.34523984933830528860918339265097582 -1
+-8.38143342755524846875570469976848365 0
+-6.53167358191348375502677177380274565 1
++9.26705696697258528046907106996633473 2
++0.66198589809950443806520229507072615 3
+-0.40660392238535529519351490505650392 4
++0.56175974622072409170769641066459813 5
++0.77415229659130372834006997382367211 6
+-0.67876370263940246316802166606111153 7
+EOF
+       ;;
+       dd_*|ff_*|ll_*) ./gen $N >$D/$N.h <<EOF
+-8.06684839057968126823036836721962107 +4.53566256067686864057537788388811764
++4.34523984933830528860918339265097582 -8.88799136300345123622768770110757083
+-8.38143342755524846875570469976848365 -2.76360733737958805493258686740202557
+-6.53167358191348375502677177380274565 +4.56753527684274348416184388263831508
++9.26705696697258528046907106996633473 +4.81139208435979589730560859417420750
+-6.45004555606023597579444426311945845 +0.66207179233767389593411946503559251
++7.85889025304169636815211127446301636 +0.05215452675006224789817853073306709
+-0.79205451198489594412029014134600873 +7.67640268511754002832536318951411755
++0.61570267319792408792325107549103713 +2.01190257903248027376896111888376742
+-0.55875868236091523814033056701077708 +0.03223983060263803856752696457418850
+EOF
+       ;;
+       *) echo "bad type: $T"
+       ;;
+       esac
+done
+
index 0331313..0effca2 100644 (file)
@@ -497,10 +497,48 @@ int mplogbl(struct t *t)
 int mpnearbyint(struct t *t) { return mpd1(t, wrap_nearbyint) || (t->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); }
index 0546202..fffed54 100644 (file)
@@ -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 (file)
index 0000000..962cce4
--- /dev/null
@@ -0,0 +1,45 @@
+#include <stdint.h>
+#include <stdio.h>
+#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 (file)
index 0000000..962cce4
--- /dev/null
@@ -0,0 +1,45 @@
+#include <stdint.h>
+#include <stdio.h>
+#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;
+}
index 02c6edc..8c47fb5 100644 (file)
@@ -3,6 +3,7 @@
 #include "util.h"
 
 static struct dd_d t[] = {
+#include "sanity/nextafter.h"
 
 };
 
index e0aae93..8a8033d 100644 (file)
@@ -3,6 +3,7 @@
 #include "util.h"
 
 static struct ff_f t[] = {
+#include "sanity/nextafterf.h"
 
 };
 
index 23b94fd..2e9fc06 100644 (file)
@@ -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 (file)
index 0000000..9a87d00
--- /dev/null
@@ -0,0 +1,47 @@
+#include <stdint.h>
+#include <stdio.h>
+#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 (file)
index 0000000..c402015
--- /dev/null
@@ -0,0 +1,47 @@
+#include <stdint.h>
+#include <stdio.h>
+#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;
+}
index f38c36e..5f28334 100644 (file)
@@ -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 (file)
index 0000000..96eb6e9
--- /dev/null
@@ -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 (file)
index 0000000..741b9b0
--- /dev/null
@@ -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 (file)
index 0000000..e84d062
--- /dev/null
@@ -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 (file)
index 0000000..8cf5f43
--- /dev/null
@@ -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 (file)
index 0000000..a403d33
--- /dev/null
@@ -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 (file)
index 0000000..e84d062
--- /dev/null
@@ -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 (file)
index 0000000..a964794
--- /dev/null
@@ -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 (file)
index 0000000..caf8170
--- /dev/null
@@ -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)
index 88b529b..35ef2ce 100644 (file)
@@ -3,6 +3,7 @@
 #include "util.h"
 
 static struct dd_d t[] = {
+#include "sanity/scalb.h"
 
 };
 
index d91dff4..233c14d 100644 (file)
@@ -3,6 +3,7 @@
 #include "util.h"
 
 static struct ff_f t[] = {
+#include "sanity/scalbf.h"
 
 };