1 diff -Naurd mpfr-3.1.6-a/PATCHES mpfr-3.1.6-b/PATCHES
2 --- mpfr-3.1.6-a/PATCHES 2017-10-26 13:55:51.168013439 +0000
3 +++ mpfr-3.1.6-b/PATCHES 2017-10-26 13:55:51.236013121 +0000
6 diff -Naurd mpfr-3.1.6-a/VERSION mpfr-3.1.6-b/VERSION
7 --- mpfr-3.1.6-a/VERSION 2017-09-07 11:36:44.000000000 +0000
8 +++ mpfr-3.1.6-b/VERSION 2017-10-26 13:55:51.236013121 +0000
12 diff -Naurd mpfr-3.1.6-a/src/get_ld.c mpfr-3.1.6-b/src/get_ld.c
13 --- mpfr-3.1.6-a/src/get_ld.c 2017-01-01 01:39:09.000000000 +0000
14 +++ mpfr-3.1.6-b/src/get_ld.c 2017-10-26 13:55:51.208013252 +0000
16 mpfr_exp_t sh; /* exponent shift, so that x/2^sh is in the double range */
19 + MPFR_SAVE_EXPO_DECL (expo);
21 + MPFR_SAVE_EXPO_MARK (expo);
23 /* first round x to the target long double precision, so that
24 all subsequent operations are exact (this avoids double rounding
29 + MPFR_SAVE_EXPO_FREE (expo);
33 diff -Naurd mpfr-3.1.6-a/src/get_si.c mpfr-3.1.6-b/src/get_si.c
34 --- mpfr-3.1.6-a/src/get_si.c 2017-01-01 01:39:09.000000000 +0000
35 +++ mpfr-3.1.6-b/src/get_si.c 2017-10-26 13:55:51.208013252 +0000
40 + MPFR_SAVE_EXPO_DECL (expo);
42 if (MPFR_UNLIKELY (!mpfr_fits_slong_p (f, rnd)))
48 - /* determine prec of long */
49 - for (s = LONG_MIN, prec = 0; s != 0; s /= 2, prec++)
50 + /* Determine the precision of long. |LONG_MIN| may have one more bit
51 + as an integer, but in this case, this is a power of 2, thus fits
52 + in a precision-prec floating-point number. */
53 + for (s = LONG_MAX, prec = 0; s != 0; s /= 2, prec++)
56 + MPFR_SAVE_EXPO_MARK (expo);
58 /* first round to prec bits */
60 mpfr_rint (x, f, rnd);
62 + /* The flags from mpfr_rint are the wanted ones. In particular,
63 + it sets the inexact flag when necessary. */
64 + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
66 /* warning: if x=0, taking its exponent is illegal */
67 if (MPFR_UNLIKELY (MPFR_IS_ZERO(x)))
73 + MPFR_SAVE_EXPO_FREE (expo);
77 diff -Naurd mpfr-3.1.6-a/src/get_sj.c mpfr-3.1.6-b/src/get_sj.c
78 --- mpfr-3.1.6-a/src/get_sj.c 2017-01-01 01:39:09.000000000 +0000
79 +++ mpfr-3.1.6-b/src/get_sj.c 2017-10-26 13:55:51.208013252 +0000
84 + MPFR_SAVE_EXPO_DECL (expo);
86 if (MPFR_UNLIKELY (!mpfr_fits_intmax_p (f, rnd)))
92 - /* determine the precision of intmax_t */
93 - for (r = MPFR_INTMAX_MIN, prec = 0; r != 0; r /= 2, prec++)
94 + /* Determine the precision of intmax_t. |INTMAX_MIN| may have one
95 + more bit as an integer, but in this case, this is a power of 2,
96 + thus fits in a precision-prec floating-point number. */
97 + for (r = MPFR_INTMAX_MAX, prec = 0; r != 0; r /= 2, prec++)
99 - /* Note: though INTMAX_MAX would have been sufficient for the conversion,
100 - we chose INTMAX_MIN so that INTMAX_MIN - 1 is always representable in
101 - precision prec; this is useful to detect overflows in MPFR_RNDZ (will
102 - be needed later). */
105 + MPFR_ASSERTD (r == 0);
107 + MPFR_SAVE_EXPO_MARK (expo);
109 mpfr_init2 (x, prec);
110 mpfr_rint (x, f, rnd);
111 MPFR_ASSERTN (MPFR_IS_FP (x));
113 + /* The flags from mpfr_rint are the wanted ones. In particular,
114 + it sets the inexact flag when necessary. */
115 + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
117 if (MPFR_NOTZERO (x))
123 sh = MPFR_GET_EXP (x);
124 - MPFR_ASSERTN ((mpfr_prec_t) sh <= prec);
125 + MPFR_ASSERTN ((mpfr_prec_t) sh <= prec + 1);
126 if (MPFR_INTMAX_MIN + MPFR_INTMAX_MAX != 0
127 - && MPFR_UNLIKELY ((mpfr_prec_t) sh == prec))
128 + && MPFR_UNLIKELY ((mpfr_prec_t) sh > prec))
130 /* 2's complement and x <= INTMAX_MIN: in the case mp_limb_t
131 has the same size as intmax_t, we cannot use the code in
132 the for loop since the operations would be performed in
133 unsigned arithmetic. */
134 - MPFR_ASSERTN (MPFR_IS_NEG (x) && (mpfr_powerof2_raw (x)));
135 + MPFR_ASSERTN (MPFR_IS_NEG (x) && mpfr_powerof2_raw (x));
138 else if (MPFR_IS_POS (x))
143 + MPFR_SAVE_EXPO_FREE (expo);
148 diff -Naurd mpfr-3.1.6-a/src/get_ui.c mpfr-3.1.6-b/src/get_ui.c
149 --- mpfr-3.1.6-a/src/get_ui.c 2017-01-01 01:39:09.000000000 +0000
150 +++ mpfr-3.1.6-b/src/get_ui.c 2017-10-26 13:55:51.208013252 +0000
155 + MPFR_SAVE_EXPO_DECL (expo);
157 if (MPFR_UNLIKELY (!mpfr_fits_ulong_p (f, rnd)))
160 for (s = ULONG_MAX, prec = 0; s != 0; s /= 2, prec ++)
163 + MPFR_SAVE_EXPO_MARK (expo);
165 /* first round to prec bits */
166 mpfr_init2 (x, prec);
167 mpfr_rint (x, f, rnd);
169 + /* The flags from mpfr_rint are the wanted ones. In particular,
170 + it sets the inexact flag when necessary. */
171 + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
173 /* warning: if x=0, taking its exponent is illegal */
180 + MPFR_SAVE_EXPO_FREE (expo);
184 diff -Naurd mpfr-3.1.6-a/src/get_uj.c mpfr-3.1.6-b/src/get_uj.c
185 --- mpfr-3.1.6-a/src/get_uj.c 2017-01-01 01:39:09.000000000 +0000
186 +++ mpfr-3.1.6-b/src/get_uj.c 2017-10-26 13:55:51.208013252 +0000
191 + MPFR_SAVE_EXPO_DECL (expo);
193 if (MPFR_UNLIKELY (!mpfr_fits_uintmax_p (f, rnd)))
196 for (r = MPFR_UINTMAX_MAX, prec = 0; r != 0; r /= 2, prec++)
200 + MPFR_ASSERTD (r == 0);
202 + MPFR_SAVE_EXPO_MARK (expo);
204 mpfr_init2 (x, prec);
205 mpfr_rint (x, f, rnd);
206 MPFR_ASSERTN (MPFR_IS_FP (x));
208 + /* The flags from mpfr_rint are the wanted ones. In particular,
209 + it sets the inexact flag when necessary. */
210 + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
212 if (MPFR_NOTZERO (x))
219 + MPFR_SAVE_EXPO_FREE (expo);
224 diff -Naurd mpfr-3.1.6-a/src/get_z.c mpfr-3.1.6-b/src/get_z.c
225 --- mpfr-3.1.6-a/src/get_z.c 2017-01-01 01:39:09.000000000 +0000
226 +++ mpfr-3.1.6-b/src/get_z.c 2017-10-26 13:55:51.208013252 +0000
231 + MPFR_SAVE_EXPO_DECL (expo);
233 if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f)))
239 + MPFR_SAVE_EXPO_MARK (expo);
241 exp = MPFR_GET_EXP (f);
242 /* if exp <= 0, then |f|<1, thus |o(f)|<=1 */
243 MPFR_ASSERTN (exp < 0 || exp <= MPFR_PREC_MAX);
245 MPFR_ASSERTN (inex != 1 && inex != -1); /* integral part of f is
246 representable in r */
247 MPFR_ASSERTN (MPFR_IS_FP (r));
249 + /* The flags from mpfr_rint are the wanted ones. In particular,
250 + it sets the inexact flag when necessary. */
251 + MPFR_SAVE_EXPO_UPDATE_FLAGS (expo, __gmpfr_flags);
253 exp = mpfr_get_z_2exp (z, r);
255 mpz_mul_2exp (z, z, exp);
257 mpz_fdiv_q_2exp (z, z, -exp);
260 + MPFR_SAVE_EXPO_FREE (expo);
264 diff -Naurd mpfr-3.1.6-a/src/mpfr.h mpfr-3.1.6-b/src/mpfr.h
265 --- mpfr-3.1.6-a/src/mpfr.h 2017-09-07 11:36:44.000000000 +0000
266 +++ mpfr-3.1.6-b/src/mpfr.h 2017-10-26 13:55:51.232013138 +0000
268 #define MPFR_VERSION_MAJOR 3
269 #define MPFR_VERSION_MINOR 1
270 #define MPFR_VERSION_PATCHLEVEL 6
271 -#define MPFR_VERSION_STRING "3.1.6"
272 +#define MPFR_VERSION_STRING "3.1.6-p1"
274 /* Macros dealing with MPFR VERSION */
275 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
276 diff -Naurd mpfr-3.1.6-a/src/version.c mpfr-3.1.6-b/src/version.c
277 --- mpfr-3.1.6-a/src/version.c 2017-09-07 11:36:44.000000000 +0000
278 +++ mpfr-3.1.6-b/src/version.c 2017-10-26 13:55:51.232013138 +0000
281 mpfr_get_version (void)