summaryrefslogtreecommitdiff
path: root/patches/mpfr/3.1.3/120-muldiv-2exp-overflow.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/mpfr/3.1.3/120-muldiv-2exp-overflow.patch')
-rw-r--r--patches/mpfr/3.1.3/120-muldiv-2exp-overflow.patch161
1 files changed, 0 insertions, 161 deletions
diff --git a/patches/mpfr/3.1.3/120-muldiv-2exp-overflow.patch b/patches/mpfr/3.1.3/120-muldiv-2exp-overflow.patch
deleted file mode 100644
index df711fd..0000000
--- a/patches/mpfr/3.1.3/120-muldiv-2exp-overflow.patch
+++ /dev/null
@@ -1,161 +0,0 @@
-diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
---- mpfr-3.1.3-a/PATCHES 2015-07-02 10:50:08.046573308 +0000
-+++ mpfr-3.1.3-b/PATCHES 2015-07-02 10:50:08.126574142 +0000
-@@ -0,0 +1 @@
-+muldiv-2exp-overflow
-diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
---- mpfr-3.1.3-a/VERSION 2015-07-02 10:49:24.042113845 +0000
-+++ mpfr-3.1.3-b/VERSION 2015-07-02 10:50:08.126574142 +0000
-@@ -1 +1 @@
--3.1.3-p1
-+3.1.3-p2
-diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
---- mpfr-3.1.3-a/src/div_2si.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/div_2si.c 2015-07-02 10:50:08.106573933 +0000
-@@ -49,7 +49,7 @@
- rnd_mode = MPFR_RNDZ;
- return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
- }
-- else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
-+ else if (MPFR_UNLIKELY(n <= 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
- exp > __gmpfr_emax + n)) )
- return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
-
-diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
---- mpfr-3.1.3-a/src/div_2ui.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/div_2ui.c 2015-07-02 10:50:08.106573933 +0000
-@@ -32,7 +32,7 @@
- rnd_mode),
- ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
-
-- if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
-+ if (MPFR_UNLIKELY (n == 0 || MPFR_IS_SINGULAR (x)))
- return mpfr_set (y, x, rnd_mode);
- else
- {
-diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
---- mpfr-3.1.3-a/src/mpfr.h 2015-07-02 10:49:24.038113803 +0000
-+++ mpfr-3.1.3-b/src/mpfr.h 2015-07-02 10:50:08.126574142 +0000
-@@ -27,7 +27,7 @@
- #define MPFR_VERSION_MAJOR 3
- #define MPFR_VERSION_MINOR 1
- #define MPFR_VERSION_PATCHLEVEL 3
--#define MPFR_VERSION_STRING "3.1.3-p1"
-+#define MPFR_VERSION_STRING "3.1.3-p2"
-
- /* Macros dealing with MPFR VERSION */
- #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
-diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
---- mpfr-3.1.3-a/src/mul_2si.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/src/mul_2si.c 2015-07-02 10:50:08.106573933 +0000
-@@ -39,7 +39,7 @@
- {
- mpfr_exp_t exp = MPFR_GET_EXP (x);
- MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
-- if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
-+ if (MPFR_UNLIKELY(n >= 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
- exp > __gmpfr_emax - n)))
- return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
- else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
-diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
---- mpfr-3.1.3-a/src/version.c 2015-07-02 10:49:24.042113845 +0000
-+++ mpfr-3.1.3-b/src/version.c 2015-07-02 10:50:08.126574142 +0000
-@@ -25,5 +25,5 @@
- const char *
- mpfr_get_version (void)
- {
-- return "3.1.3-p1";
-+ return "3.1.3-p2";
- }
-diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
---- mpfr-3.1.3-a/tests/tmul_2exp.c 2015-06-19 19:55:10.000000000 +0000
-+++ mpfr-3.1.3-b/tests/tmul_2exp.c 2015-07-02 10:50:08.106573933 +0000
-@@ -242,6 +242,76 @@
- large (MPFR_EMAX_MAX);
- }
-
-+/* Cases where the function overflows on n = 0 when rounding is like
-+ away from zero. */
-+static void
-+overflow0 (mpfr_exp_t emax)
-+{
-+ mpfr_exp_t old_emax;
-+ mpfr_t x, y1, y2;
-+ int neg, r, op;
-+ static char *sop[4] = { "mul_2ui", "mul_2si", "div_2ui", "div_2si" };
-+
-+ old_emax = mpfr_get_emax ();
-+ set_emax (emax);
-+
-+ mpfr_init2 (x, 8);
-+ mpfr_inits2 (6, y1, y2, (mpfr_ptr) 0);
-+
-+ mpfr_set_inf (x, 1);
-+ mpfr_nextbelow (x);
-+
-+ for (neg = 0; neg <= 1; neg++)
-+ {
-+ RND_LOOP (r)
-+ {
-+ int inex1, inex2;
-+ unsigned int flags1, flags2;
-+
-+ /* Even if there isn't an overflow (rounding ~ toward zero),
-+ the result is the same as the one of an overflow. */
-+ inex1 = mpfr_overflow (y1, (mpfr_rnd_t) r, neg ? -1 : 1);
-+ flags1 = MPFR_FLAGS_INEXACT;
-+ if (mpfr_inf_p (y1))
-+ flags1 |= MPFR_FLAGS_OVERFLOW;
-+ for (op = 0; op < 4; op++)
-+ {
-+ mpfr_clear_flags ();
-+ inex2 =
-+ op == 0 ? mpfr_mul_2ui (y2, x, 0, (mpfr_rnd_t) r) :
-+ op == 1 ? mpfr_mul_2si (y2, x, 0, (mpfr_rnd_t) r) :
-+ op == 2 ? mpfr_div_2ui (y2, x, 0, (mpfr_rnd_t) r) :
-+ op == 3 ? mpfr_div_2si (y2, x, 0, (mpfr_rnd_t) r) :
-+ (MPFR_ASSERTN (0), 0);
-+ flags2 = __gmpfr_flags;
-+ if (!(mpfr_equal_p (y1, y2) &&
-+ SAME_SIGN (inex1, inex2) &&
-+ flags1 == flags2))
-+ {
-+ printf ("Error in overflow0 for %s, mpfr_%s, emax = %"
-+ MPFR_EXP_FSPEC "d,\nx = ",
-+ mpfr_print_rnd_mode ((mpfr_rnd_t) r), sop[op],
-+ (mpfr_eexp_t) emax);
-+ mpfr_dump (x);
-+ printf ("Expected ");
-+ mpfr_dump (y1);
-+ printf (" with inex = %d, flags =", inex1);
-+ flags_out (flags1);
-+ printf ("Got ");
-+ mpfr_dump (y2);
-+ printf (" with inex = %d, flags =", inex2);
-+ flags_out (flags2);
-+ exit (1);
-+ }
-+ }
-+ }
-+ mpfr_neg (x, x, MPFR_RNDN);
-+ }
-+
-+ mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
-+ set_emax (old_emax);
-+}
-+
- int
- main (int argc, char *argv[])
- {
-@@ -334,6 +404,11 @@
- underflow0 ();
- large0 ();
-
-+ if (mpfr_get_emax () != MPFR_EMAX_MAX)
-+ overflow0 (mpfr_get_emax ());
-+ overflow0 (MPFR_EMAX_MAX);
-+ overflow0 (-1);
-+
- tests_end_mpfr ();
- return 0;
- }