[5fde8c4] | 1 | Submitted By: William Harrington (kb0iic at cross-lfs dot org) |
---|
| 2 | Date: 2014-07-21 |
---|
| 3 | Initial Package Version: 3.1.2 |
---|
| 4 | Origin: Upstream |
---|
| 5 | Upstream Status: Applied |
---|
| 6 | Description: Contains all upstream patches of mpfr current to patch level 10. |
---|
| 7 | |
---|
| 8 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 9 | --- mpfr-3.1.2-a/PATCHES 2013-09-26 10:52:52.000000000 +0000 |
---|
| 10 | +++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:52:52.000000000 +0000 |
---|
| 11 | @@ -0,0 +1 @@ |
---|
| 12 | +exp_2 |
---|
| 13 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 14 | --- mpfr-3.1.2-a/VERSION 2013-03-13 15:37:28.000000000 +0000 |
---|
| 15 | +++ mpfr-3.1.2-b/VERSION 2013-09-26 10:52:52.000000000 +0000 |
---|
| 16 | @@ -1 +1 @@ |
---|
| 17 | -3.1.2 |
---|
| 18 | +3.1.2-p1 |
---|
| 19 | diff -Naurd mpfr-3.1.2-a/src/exp_2.c mpfr-3.1.2-b/src/exp_2.c |
---|
| 20 | --- mpfr-3.1.2-a/src/exp_2.c 2013-03-13 15:37:28.000000000 +0000 |
---|
| 21 | +++ mpfr-3.1.2-b/src/exp_2.c 2013-09-26 10:52:52.000000000 +0000 |
---|
| 22 | @@ -204,7 +204,7 @@ |
---|
| 23 | for (k = 0; k < K; k++) |
---|
| 24 | { |
---|
| 25 | mpz_mul (ss, ss, ss); |
---|
| 26 | - exps <<= 1; |
---|
| 27 | + exps *= 2; |
---|
| 28 | exps += mpz_normalize (ss, ss, q); |
---|
| 29 | } |
---|
| 30 | mpfr_set_z (s, ss, MPFR_RNDN); |
---|
| 31 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 32 | --- mpfr-3.1.2-a/src/mpfr.h 2013-03-13 15:37:37.000000000 +0000 |
---|
| 33 | +++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 |
---|
| 34 | @@ -27,7 +27,7 @@ |
---|
| 35 | #define MPFR_VERSION_MAJOR 3 |
---|
| 36 | #define MPFR_VERSION_MINOR 1 |
---|
| 37 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 38 | -#define MPFR_VERSION_STRING "3.1.2" |
---|
| 39 | +#define MPFR_VERSION_STRING "3.1.2-p1" |
---|
| 40 | |
---|
| 41 | /* Macros dealing with MPFR VERSION */ |
---|
| 42 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 43 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 44 | --- mpfr-3.1.2-a/src/version.c 2013-03-13 15:37:34.000000000 +0000 |
---|
| 45 | +++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:52:52.000000000 +0000 |
---|
| 46 | @@ -25,5 +25,5 @@ |
---|
| 47 | const char * |
---|
| 48 | mpfr_get_version (void) |
---|
| 49 | { |
---|
| 50 | - return "3.1.2"; |
---|
| 51 | + return "3.1.2-p1"; |
---|
| 52 | } |
---|
| 53 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 54 | --- mpfr-3.1.2-a/PATCHES 2013-09-26 10:56:55.000000000 +0000 |
---|
| 55 | +++ mpfr-3.1.2-b/PATCHES 2013-09-26 10:56:55.000000000 +0000 |
---|
| 56 | @@ -0,0 +1 @@ |
---|
| 57 | +fits-smallneg |
---|
| 58 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 59 | --- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000 |
---|
| 60 | +++ mpfr-3.1.2-b/VERSION 2013-09-26 10:56:55.000000000 +0000 |
---|
| 61 | @@ -1 +1 @@ |
---|
| 62 | -3.1.2-p1 |
---|
| 63 | +3.1.2-p2 |
---|
| 64 | diff -Naurd mpfr-3.1.2-a/src/fits_u.h mpfr-3.1.2-b/src/fits_u.h |
---|
| 65 | --- mpfr-3.1.2-a/src/fits_u.h 2013-03-13 15:37:35.000000000 +0000 |
---|
| 66 | +++ mpfr-3.1.2-b/src/fits_u.h 2013-09-26 10:56:55.000000000 +0000 |
---|
| 67 | @@ -32,17 +32,20 @@ |
---|
| 68 | int res; |
---|
| 69 | |
---|
| 70 | if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) |
---|
| 71 | - /* Zero always fit */ |
---|
| 72 | - return MPFR_IS_ZERO (f) ? 1 : 0; |
---|
| 73 | - else if (MPFR_IS_NEG (f)) |
---|
| 74 | - /* Negative numbers don't fit */ |
---|
| 75 | - return 0; |
---|
| 76 | - /* now it fits if |
---|
| 77 | - (a) f <= MAXIMUM |
---|
| 78 | - (b) round(f, prec(slong), rnd) <= MAXIMUM */ |
---|
| 79 | + return MPFR_IS_ZERO (f) ? 1 : 0; /* Zero always fits */ |
---|
| 80 | |
---|
| 81 | e = MPFR_GET_EXP (f); |
---|
| 82 | |
---|
| 83 | + if (MPFR_IS_NEG (f)) |
---|
| 84 | + return e >= 1 ? 0 /* f <= -1 does not fit */ |
---|
| 85 | + : rnd != MPFR_RNDN ? MPFR_IS_LIKE_RNDU (rnd, -1) /* directed mode */ |
---|
| 86 | + : e < 0 ? 1 /* f > -1/2 fits in MPFR_RNDN */ |
---|
| 87 | + : mpfr_powerof2_raw(f); /* -1/2 fits, -1 < f < -1/2 don't */ |
---|
| 88 | + |
---|
| 89 | + /* Now it fits if |
---|
| 90 | + (a) f <= MAXIMUM |
---|
| 91 | + (b) round(f, prec(slong), rnd) <= MAXIMUM */ |
---|
| 92 | + |
---|
| 93 | /* first compute prec(MAXIMUM); fits in an int */ |
---|
| 94 | for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++); |
---|
| 95 | |
---|
| 96 | diff -Naurd mpfr-3.1.2-a/src/fits_uintmax.c mpfr-3.1.2-b/src/fits_uintmax.c |
---|
| 97 | --- mpfr-3.1.2-a/src/fits_uintmax.c 2013-03-13 15:37:33.000000000 +0000 |
---|
| 98 | +++ mpfr-3.1.2-b/src/fits_uintmax.c 2013-09-26 10:56:55.000000000 +0000 |
---|
| 99 | @@ -27,51 +27,19 @@ |
---|
| 100 | #include "mpfr-intmax.h" |
---|
| 101 | #include "mpfr-impl.h" |
---|
| 102 | |
---|
| 103 | -#ifdef _MPFR_H_HAVE_INTMAX_T |
---|
| 104 | - |
---|
| 105 | -/* We can't use fits_u.h <= mpfr_cmp_ui */ |
---|
| 106 | -int |
---|
| 107 | -mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) |
---|
| 108 | -{ |
---|
| 109 | - mpfr_exp_t e; |
---|
| 110 | - int prec; |
---|
| 111 | - uintmax_t s; |
---|
| 112 | - mpfr_t x; |
---|
| 113 | - int res; |
---|
| 114 | - |
---|
| 115 | - if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) |
---|
| 116 | - /* Zero always fit */ |
---|
| 117 | - return MPFR_IS_ZERO (f) ? 1 : 0; |
---|
| 118 | - else if (MPFR_IS_NEG (f)) |
---|
| 119 | - /* Negative numbers don't fit */ |
---|
| 120 | - return 0; |
---|
| 121 | - /* now it fits if |
---|
| 122 | - (a) f <= MAXIMUM |
---|
| 123 | - (b) round(f, prec(slong), rnd) <= MAXIMUM */ |
---|
| 124 | - |
---|
| 125 | - e = MPFR_GET_EXP (f); |
---|
| 126 | - |
---|
| 127 | - /* first compute prec(MAXIMUM); fits in an int */ |
---|
| 128 | - for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++); |
---|
| 129 | - |
---|
| 130 | - /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */ |
---|
| 131 | - |
---|
| 132 | - /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */ |
---|
| 133 | - if (e <= prec - 1) |
---|
| 134 | - return 1; |
---|
| 135 | +/* Note: though mpfr-impl.h is included in fits_u.h, we also include it |
---|
| 136 | + above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not |
---|
| 137 | + defined; this is necessary to avoid an empty translation unit, which |
---|
| 138 | + is forbidden by ISO C. Without this, a failing test can be reproduced |
---|
| 139 | + by creating an invalid stdint.h somewhere in the default include path |
---|
| 140 | + and by compiling MPFR with "gcc -ansi -pedantic-errors". */ |
---|
| 141 | |
---|
| 142 | - /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */ |
---|
| 143 | - if (e >= prec + 1) |
---|
| 144 | - return 0; |
---|
| 145 | +#ifdef _MPFR_H_HAVE_INTMAX_T |
---|
| 146 | |
---|
| 147 | - MPFR_ASSERTD (e == prec); |
---|
| 148 | +#define FUNCTION mpfr_fits_uintmax_p |
---|
| 149 | +#define MAXIMUM MPFR_UINTMAX_MAX |
---|
| 150 | +#define TYPE uintmax_t |
---|
| 151 | |
---|
| 152 | - /* hard case: first round to prec bits, then check */ |
---|
| 153 | - mpfr_init2 (x, prec); |
---|
| 154 | - mpfr_set (x, f, rnd); |
---|
| 155 | - res = MPFR_GET_EXP (x) == e; |
---|
| 156 | - mpfr_clear (x); |
---|
| 157 | - return res; |
---|
| 158 | -} |
---|
| 159 | +#include "fits_u.h" |
---|
| 160 | |
---|
| 161 | #endif |
---|
| 162 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 163 | --- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 |
---|
| 164 | +++ mpfr-3.1.2-b/src/mpfr.h 2013-09-26 10:56:55.000000000 +0000 |
---|
| 165 | @@ -27,7 +27,7 @@ |
---|
| 166 | #define MPFR_VERSION_MAJOR 3 |
---|
| 167 | #define MPFR_VERSION_MINOR 1 |
---|
| 168 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 169 | -#define MPFR_VERSION_STRING "3.1.2-p1" |
---|
| 170 | +#define MPFR_VERSION_STRING "3.1.2-p2" |
---|
| 171 | |
---|
| 172 | /* Macros dealing with MPFR VERSION */ |
---|
| 173 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 174 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 175 | --- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000 |
---|
| 176 | +++ mpfr-3.1.2-b/src/version.c 2013-09-26 10:56:55.000000000 +0000 |
---|
| 177 | @@ -25,5 +25,5 @@ |
---|
| 178 | const char * |
---|
| 179 | mpfr_get_version (void) |
---|
| 180 | { |
---|
| 181 | - return "3.1.2-p1"; |
---|
| 182 | + return "3.1.2-p2"; |
---|
| 183 | } |
---|
| 184 | diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c |
---|
| 185 | --- mpfr-3.1.2-a/tests/tfits.c 2013-03-13 15:37:45.000000000 +0000 |
---|
| 186 | +++ mpfr-3.1.2-b/tests/tfits.c 2013-09-26 10:56:55.000000000 +0000 |
---|
| 187 | @@ -33,155 +33,176 @@ |
---|
| 188 | #include "mpfr-intmax.h" |
---|
| 189 | #include "mpfr-test.h" |
---|
| 190 | |
---|
| 191 | -#define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); } |
---|
| 192 | -#define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); } |
---|
| 193 | +#define ERROR1(N) \ |
---|
| 194 | + do \ |
---|
| 195 | + { \ |
---|
| 196 | + printf("Error %d for rnd = %s and x = ", N, \ |
---|
| 197 | + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \ |
---|
| 198 | + mpfr_dump(x); \ |
---|
| 199 | + exit(1); \ |
---|
| 200 | + } \ |
---|
| 201 | + while (0) |
---|
| 202 | |
---|
| 203 | static void check_intmax (void); |
---|
| 204 | |
---|
| 205 | int |
---|
| 206 | main (void) |
---|
| 207 | { |
---|
| 208 | - mpfr_t x; |
---|
| 209 | + mpfr_t x, y; |
---|
| 210 | + int i, r; |
---|
| 211 | |
---|
| 212 | tests_start_mpfr (); |
---|
| 213 | |
---|
| 214 | mpfr_init2 (x, 256); |
---|
| 215 | + mpfr_init2 (y, 8); |
---|
| 216 | |
---|
| 217 | - /* Check NAN */ |
---|
| 218 | - mpfr_set_nan (x); |
---|
| 219 | - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 220 | - ERROR1; |
---|
| 221 | - if (mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 222 | - ERROR1; |
---|
| 223 | - if (mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 224 | - ERROR1; |
---|
| 225 | - if (mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 226 | - ERROR1; |
---|
| 227 | - if (mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 228 | - ERROR1; |
---|
| 229 | - if (mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 230 | - ERROR1; |
---|
| 231 | + RND_LOOP (r) |
---|
| 232 | + { |
---|
| 233 | |
---|
| 234 | - /* Check INF */ |
---|
| 235 | - mpfr_set_inf (x, 1); |
---|
| 236 | - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 237 | - ERROR1; |
---|
| 238 | - if (mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 239 | - ERROR1; |
---|
| 240 | - if (mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 241 | - ERROR1; |
---|
| 242 | - if (mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 243 | - ERROR1; |
---|
| 244 | - if (mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 245 | - ERROR1; |
---|
| 246 | - if (mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 247 | - ERROR1; |
---|
| 248 | + /* Check NAN */ |
---|
| 249 | + mpfr_set_nan (x); |
---|
| 250 | + if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 251 | + ERROR1 (1); |
---|
| 252 | + if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 253 | + ERROR1 (2); |
---|
| 254 | + if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 255 | + ERROR1 (3); |
---|
| 256 | + if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 257 | + ERROR1 (4); |
---|
| 258 | + if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 259 | + ERROR1 (5); |
---|
| 260 | + if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 261 | + ERROR1 (6); |
---|
| 262 | |
---|
| 263 | - /* Check Zero */ |
---|
| 264 | - MPFR_SET_ZERO (x); |
---|
| 265 | - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 266 | - ERROR2; |
---|
| 267 | - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 268 | - ERROR2; |
---|
| 269 | - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 270 | - ERROR2; |
---|
| 271 | - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 272 | - ERROR2; |
---|
| 273 | - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 274 | - ERROR2; |
---|
| 275 | - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 276 | - ERROR2; |
---|
| 277 | + /* Check INF */ |
---|
| 278 | + mpfr_set_inf (x, 1); |
---|
| 279 | + if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 280 | + ERROR1 (7); |
---|
| 281 | + if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 282 | + ERROR1 (8); |
---|
| 283 | + if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 284 | + ERROR1 (9); |
---|
| 285 | + if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 286 | + ERROR1 (10); |
---|
| 287 | + if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 288 | + ERROR1 (11); |
---|
| 289 | + if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 290 | + ERROR1 (12); |
---|
| 291 | |
---|
| 292 | - /* Check small op */ |
---|
| 293 | - mpfr_set_str1 (x, "1@-1"); |
---|
| 294 | - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 295 | - ERROR2; |
---|
| 296 | - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 297 | - ERROR2; |
---|
| 298 | - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 299 | - ERROR2; |
---|
| 300 | - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 301 | - ERROR2; |
---|
| 302 | - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 303 | - ERROR2; |
---|
| 304 | - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 305 | - ERROR2; |
---|
| 306 | + /* Check Zero */ |
---|
| 307 | + MPFR_SET_ZERO (x); |
---|
| 308 | + if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 309 | + ERROR1 (13); |
---|
| 310 | + if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 311 | + ERROR1 (14); |
---|
| 312 | + if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 313 | + ERROR1 (15); |
---|
| 314 | + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 315 | + ERROR1 (16); |
---|
| 316 | + if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 317 | + ERROR1 (17); |
---|
| 318 | + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 319 | + ERROR1 (18); |
---|
| 320 | |
---|
| 321 | - /* Check 17 */ |
---|
| 322 | - mpfr_set_ui (x, 17, MPFR_RNDN); |
---|
| 323 | - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 324 | - ERROR2; |
---|
| 325 | - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 326 | - ERROR2; |
---|
| 327 | - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 328 | - ERROR2; |
---|
| 329 | - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 330 | - ERROR2; |
---|
| 331 | - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 332 | - ERROR2; |
---|
| 333 | - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 334 | - ERROR2; |
---|
| 335 | + /* Check small positive op */ |
---|
| 336 | + mpfr_set_str1 (x, "1@-1"); |
---|
| 337 | + if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 338 | + ERROR1 (19); |
---|
| 339 | + if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 340 | + ERROR1 (20); |
---|
| 341 | + if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 342 | + ERROR1 (21); |
---|
| 343 | + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 344 | + ERROR1 (22); |
---|
| 345 | + if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 346 | + ERROR1 (23); |
---|
| 347 | + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 348 | + ERROR1 (24); |
---|
| 349 | |
---|
| 350 | - /* Check all other values */ |
---|
| 351 | - mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); |
---|
| 352 | - mpfr_mul_2exp (x, x, 1, MPFR_RNDN); |
---|
| 353 | - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 354 | - ERROR1; |
---|
| 355 | - if (mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 356 | - ERROR1; |
---|
| 357 | - mpfr_mul_2exp (x, x, 40, MPFR_RNDN); |
---|
| 358 | - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 359 | - ERROR1; |
---|
| 360 | - if (mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 361 | - ERROR1; |
---|
| 362 | - if (mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 363 | - ERROR1; |
---|
| 364 | - if (mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 365 | - ERROR1; |
---|
| 366 | - if (mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 367 | - ERROR1; |
---|
| 368 | + /* Check 17 */ |
---|
| 369 | + mpfr_set_ui (x, 17, MPFR_RNDN); |
---|
| 370 | + if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 371 | + ERROR1 (25); |
---|
| 372 | + if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 373 | + ERROR1 (26); |
---|
| 374 | + if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 375 | + ERROR1 (27); |
---|
| 376 | + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 377 | + ERROR1 (28); |
---|
| 378 | + if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 379 | + ERROR1 (29); |
---|
| 380 | + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 381 | + ERROR1 (30); |
---|
| 382 | |
---|
| 383 | - mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); |
---|
| 384 | - if (!mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 385 | - ERROR2; |
---|
| 386 | - mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); |
---|
| 387 | - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 388 | - ERROR2; |
---|
| 389 | - mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); |
---|
| 390 | - if (!mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 391 | - ERROR2; |
---|
| 392 | - mpfr_set_ui (x, INT_MAX, MPFR_RNDN); |
---|
| 393 | - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 394 | - ERROR2; |
---|
| 395 | - mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); |
---|
| 396 | - if (!mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 397 | - ERROR2; |
---|
| 398 | - mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); |
---|
| 399 | - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 400 | - ERROR2; |
---|
| 401 | + /* Check all other values */ |
---|
| 402 | + mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); |
---|
| 403 | + mpfr_mul_2exp (x, x, 1, MPFR_RNDN); |
---|
| 404 | + if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 405 | + ERROR1 (31); |
---|
| 406 | + if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 407 | + ERROR1 (32); |
---|
| 408 | + mpfr_mul_2exp (x, x, 40, MPFR_RNDN); |
---|
| 409 | + if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 410 | + ERROR1 (33); |
---|
| 411 | + if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 412 | + ERROR1 (34); |
---|
| 413 | + if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 414 | + ERROR1 (35); |
---|
| 415 | + if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 416 | + ERROR1 (36); |
---|
| 417 | + if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 418 | + ERROR1 (37); |
---|
| 419 | |
---|
| 420 | - mpfr_set_si (x, 1, MPFR_RNDN); |
---|
| 421 | - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 422 | - ERROR2; |
---|
| 423 | - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 424 | - ERROR2; |
---|
| 425 | + mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); |
---|
| 426 | + if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) |
---|
| 427 | + ERROR1 (38); |
---|
| 428 | + mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); |
---|
| 429 | + if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 430 | + ERROR1 (39); |
---|
| 431 | + mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); |
---|
| 432 | + if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) |
---|
| 433 | + ERROR1 (40); |
---|
| 434 | + mpfr_set_ui (x, INT_MAX, MPFR_RNDN); |
---|
| 435 | + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 436 | + ERROR1 (41); |
---|
| 437 | + mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); |
---|
| 438 | + if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) |
---|
| 439 | + ERROR1 (42); |
---|
| 440 | + mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); |
---|
| 441 | + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 442 | + ERROR1 (43); |
---|
| 443 | |
---|
| 444 | - /* Check negative value */ |
---|
| 445 | - mpfr_set_si (x, -1, MPFR_RNDN); |
---|
| 446 | - if (!mpfr_fits_sint_p (x, MPFR_RNDN)) |
---|
| 447 | - ERROR2; |
---|
| 448 | - if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) |
---|
| 449 | - ERROR2; |
---|
| 450 | - if (!mpfr_fits_slong_p (x, MPFR_RNDN)) |
---|
| 451 | - ERROR2; |
---|
| 452 | - if (mpfr_fits_uint_p (x, MPFR_RNDN)) |
---|
| 453 | - ERROR1; |
---|
| 454 | - if (mpfr_fits_ushort_p (x, MPFR_RNDN)) |
---|
| 455 | - ERROR1; |
---|
| 456 | - if (mpfr_fits_ulong_p (x, MPFR_RNDN)) |
---|
| 457 | - ERROR1; |
---|
| 458 | + mpfr_set_si (x, 1, MPFR_RNDN); |
---|
| 459 | + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 460 | + ERROR1 (44); |
---|
| 461 | + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 462 | + ERROR1 (45); |
---|
| 463 | + |
---|
| 464 | + /* Check negative op */ |
---|
| 465 | + for (i = 1; i <= 4; i++) |
---|
| 466 | + { |
---|
| 467 | + int inv; |
---|
| 468 | + |
---|
| 469 | + mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); |
---|
| 470 | + mpfr_rint (y, x, (mpfr_rnd_t) r); |
---|
| 471 | + inv = MPFR_NOTZERO (y); |
---|
| 472 | + if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r) ^ inv) |
---|
| 473 | + ERROR1 (46); |
---|
| 474 | + if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) |
---|
| 475 | + ERROR1 (47); |
---|
| 476 | + if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r) ^ inv) |
---|
| 477 | + ERROR1 (48); |
---|
| 478 | + if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) |
---|
| 479 | + ERROR1 (49); |
---|
| 480 | + if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r) ^ inv) |
---|
| 481 | + ERROR1 (50); |
---|
| 482 | + if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) |
---|
| 483 | + ERROR1 (51); |
---|
| 484 | + } |
---|
| 485 | + } |
---|
| 486 | |
---|
| 487 | mpfr_clear (x); |
---|
| 488 | + mpfr_clear (y); |
---|
| 489 | |
---|
| 490 | check_intmax (); |
---|
| 491 | |
---|
| 492 | @@ -189,85 +210,98 @@ |
---|
| 493 | return 0; |
---|
| 494 | } |
---|
| 495 | |
---|
| 496 | -static void check_intmax (void) |
---|
| 497 | +static void |
---|
| 498 | +check_intmax (void) |
---|
| 499 | { |
---|
| 500 | #ifdef _MPFR_H_HAVE_INTMAX_T |
---|
| 501 | - mpfr_t x; |
---|
| 502 | + mpfr_t x, y; |
---|
| 503 | + int i, r; |
---|
| 504 | |
---|
| 505 | - mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT); |
---|
| 506 | + mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT); |
---|
| 507 | + mpfr_init2 (y, 8); |
---|
| 508 | |
---|
| 509 | - /* Check NAN */ |
---|
| 510 | - mpfr_set_nan (x); |
---|
| 511 | - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 512 | - ERROR1; |
---|
| 513 | - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 514 | - ERROR1; |
---|
| 515 | + RND_LOOP (r) |
---|
| 516 | + { |
---|
| 517 | + /* Check NAN */ |
---|
| 518 | + mpfr_set_nan (x); |
---|
| 519 | + if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 520 | + ERROR1 (52); |
---|
| 521 | + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 522 | + ERROR1 (53); |
---|
| 523 | |
---|
| 524 | - /* Check INF */ |
---|
| 525 | - mpfr_set_inf (x, 1); |
---|
| 526 | - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 527 | - ERROR1; |
---|
| 528 | - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 529 | - ERROR1; |
---|
| 530 | + /* Check INF */ |
---|
| 531 | + mpfr_set_inf (x, 1); |
---|
| 532 | + if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 533 | + ERROR1 (54); |
---|
| 534 | + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 535 | + ERROR1 (55); |
---|
| 536 | |
---|
| 537 | - /* Check Zero */ |
---|
| 538 | - MPFR_SET_ZERO (x); |
---|
| 539 | - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 540 | - ERROR2; |
---|
| 541 | - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 542 | - ERROR2; |
---|
| 543 | + /* Check Zero */ |
---|
| 544 | + MPFR_SET_ZERO (x); |
---|
| 545 | + if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 546 | + ERROR1 (56); |
---|
| 547 | + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 548 | + ERROR1 (57); |
---|
| 549 | |
---|
| 550 | - /* Check small op */ |
---|
| 551 | - mpfr_set_str1 (x, "1@-1"); |
---|
| 552 | - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 553 | - ERROR2; |
---|
| 554 | - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 555 | - ERROR2; |
---|
| 556 | + /* Check positive small op */ |
---|
| 557 | + mpfr_set_str1 (x, "1@-1"); |
---|
| 558 | + if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 559 | + ERROR1 (58); |
---|
| 560 | + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 561 | + ERROR1 (59); |
---|
| 562 | |
---|
| 563 | - /* Check 17 */ |
---|
| 564 | - mpfr_set_ui (x, 17, MPFR_RNDN); |
---|
| 565 | - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 566 | - ERROR2; |
---|
| 567 | - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 568 | - ERROR2; |
---|
| 569 | + /* Check 17 */ |
---|
| 570 | + mpfr_set_ui (x, 17, MPFR_RNDN); |
---|
| 571 | + if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 572 | + ERROR1 (60); |
---|
| 573 | + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 574 | + ERROR1 (61); |
---|
| 575 | |
---|
| 576 | - /* Check hugest */ |
---|
| 577 | - mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); |
---|
| 578 | - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 579 | - ERROR1; |
---|
| 580 | - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 581 | - ERROR1; |
---|
| 582 | + /* Check hugest */ |
---|
| 583 | + mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); |
---|
| 584 | + if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 585 | + ERROR1 (62); |
---|
| 586 | + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 587 | + ERROR1 (63); |
---|
| 588 | |
---|
| 589 | - /* Check all other values */ |
---|
| 590 | - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); |
---|
| 591 | - mpfr_add_ui (x, x, 1, MPFR_RNDN); |
---|
| 592 | - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 593 | - ERROR1; |
---|
| 594 | - mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); |
---|
| 595 | - if (!mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 596 | - ERROR2; |
---|
| 597 | - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); |
---|
| 598 | - mpfr_add_ui (x, x, 1, MPFR_RNDN); |
---|
| 599 | - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 600 | - ERROR1; |
---|
| 601 | - mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); |
---|
| 602 | - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 603 | - ERROR2; |
---|
| 604 | - mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); |
---|
| 605 | - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 606 | - ERROR2; |
---|
| 607 | - mpfr_sub_ui (x, x, 1, MPFR_RNDN); |
---|
| 608 | - if (mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 609 | - ERROR1; |
---|
| 610 | + /* Check all other values */ |
---|
| 611 | + mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); |
---|
| 612 | + mpfr_add_ui (x, x, 1, MPFR_RNDN); |
---|
| 613 | + if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 614 | + ERROR1 (64); |
---|
| 615 | + mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); |
---|
| 616 | + if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) |
---|
| 617 | + ERROR1 (65); |
---|
| 618 | + mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); |
---|
| 619 | + mpfr_add_ui (x, x, 1, MPFR_RNDN); |
---|
| 620 | + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 621 | + ERROR1 (66); |
---|
| 622 | + mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); |
---|
| 623 | + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 624 | + ERROR1 (67); |
---|
| 625 | + mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); |
---|
| 626 | + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 627 | + ERROR1 (68); |
---|
| 628 | + mpfr_sub_ui (x, x, 1, MPFR_RNDN); |
---|
| 629 | + if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 630 | + ERROR1 (69); |
---|
| 631 | |
---|
| 632 | - /* Check negative value */ |
---|
| 633 | - mpfr_set_si (x, -1, MPFR_RNDN); |
---|
| 634 | - if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) |
---|
| 635 | - ERROR2; |
---|
| 636 | - if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) |
---|
| 637 | - ERROR1; |
---|
| 638 | + /* Check negative op */ |
---|
| 639 | + for (i = 1; i <= 4; i++) |
---|
| 640 | + { |
---|
| 641 | + int inv; |
---|
| 642 | + |
---|
| 643 | + mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); |
---|
| 644 | + mpfr_rint (y, x, (mpfr_rnd_t) r); |
---|
| 645 | + inv = MPFR_NOTZERO (y); |
---|
| 646 | + if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r) ^ inv) |
---|
| 647 | + ERROR1 (70); |
---|
| 648 | + if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) |
---|
| 649 | + ERROR1 (71); |
---|
| 650 | + } |
---|
| 651 | + } |
---|
| 652 | |
---|
| 653 | mpfr_clear (x); |
---|
| 654 | + mpfr_clear (y); |
---|
| 655 | #endif |
---|
| 656 | } |
---|
| 657 | - |
---|
| 658 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 659 | --- mpfr-3.1.2-a/PATCHES 2013-10-09 13:34:21.000000000 +0000 |
---|
| 660 | +++ mpfr-3.1.2-b/PATCHES 2013-10-09 13:34:21.000000000 +0000 |
---|
| 661 | @@ -0,0 +1 @@ |
---|
| 662 | +clang-divby0 |
---|
| 663 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 664 | --- mpfr-3.1.2-a/VERSION 2013-09-26 10:52:52.000000000 +0000 |
---|
| 665 | +++ mpfr-3.1.2-b/VERSION 2013-10-09 13:34:21.000000000 +0000 |
---|
| 666 | @@ -1 +1 @@ |
---|
| 667 | -3.1.2-p2 |
---|
| 668 | +3.1.2-p3 |
---|
| 669 | diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h |
---|
| 670 | --- mpfr-3.1.2-a/src/mpfr-impl.h 2013-03-13 15:37:36.000000000 +0000 |
---|
| 671 | +++ mpfr-3.1.2-b/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000 |
---|
| 672 | @@ -468,8 +468,16 @@ |
---|
| 673 | #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1) |
---|
| 674 | |
---|
| 675 | /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 |
---|
| 676 | - at compile time. */ |
---|
| 677 | -#if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) |
---|
| 678 | + at compile time. |
---|
| 679 | + Clang with -fsanitize=undefined is a bit similar due to a bug: |
---|
| 680 | + http://llvm.org/bugs/show_bug.cgi?id=17381 |
---|
| 681 | + but even without its sanitizer, it may be better to use the |
---|
| 682 | + double_zero version until IEEE 754 division by zero is properly |
---|
| 683 | + supported: |
---|
| 684 | + http://llvm.org/bugs/show_bug.cgi?id=17000 |
---|
| 685 | +*/ |
---|
| 686 | +#if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ |
---|
| 687 | + defined(__clang__) |
---|
| 688 | static double double_zero = 0.0; |
---|
| 689 | # define DBL_NAN (double_zero/double_zero) |
---|
| 690 | # define DBL_POS_INF ((double) 1.0/double_zero) |
---|
| 691 | @@ -501,6 +509,8 @@ |
---|
| 692 | (with Xcode 2.4.1, i.e. the latest one). */ |
---|
| 693 | #define LVALUE(x) (&(x) == &(x) || &(x) != &(x)) |
---|
| 694 | #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX)) |
---|
| 695 | +/* The DOUBLE_ISNAN(x) macro is also valid on long double x |
---|
| 696 | + (assuming that the compiler isn't too broken). */ |
---|
| 697 | #ifdef MPFR_NANISNAN |
---|
| 698 | /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. |
---|
| 699 | The + must not be replaced by a ||. With gcc -ffast-math, NaN is |
---|
| 700 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 701 | --- mpfr-3.1.2-a/src/mpfr.h 2013-09-26 10:52:52.000000000 +0000 |
---|
| 702 | +++ mpfr-3.1.2-b/src/mpfr.h 2013-10-09 13:34:21.000000000 +0000 |
---|
| 703 | @@ -27,7 +27,7 @@ |
---|
| 704 | #define MPFR_VERSION_MAJOR 3 |
---|
| 705 | #define MPFR_VERSION_MINOR 1 |
---|
| 706 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 707 | -#define MPFR_VERSION_STRING "3.1.2-p2" |
---|
| 708 | +#define MPFR_VERSION_STRING "3.1.2-p3" |
---|
| 709 | |
---|
| 710 | /* Macros dealing with MPFR VERSION */ |
---|
| 711 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 712 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 713 | --- mpfr-3.1.2-a/src/version.c 2013-09-26 10:52:52.000000000 +0000 |
---|
| 714 | +++ mpfr-3.1.2-b/src/version.c 2013-10-09 13:34:21.000000000 +0000 |
---|
| 715 | @@ -25,5 +25,5 @@ |
---|
| 716 | const char * |
---|
| 717 | mpfr_get_version (void) |
---|
| 718 | { |
---|
| 719 | - return "3.1.2-p2"; |
---|
| 720 | + return "3.1.2-p3"; |
---|
| 721 | } |
---|
| 722 | diff -Naurd mpfr-3.1.2-a/tests/tget_flt.c mpfr-3.1.2-b/tests/tget_flt.c |
---|
| 723 | --- mpfr-3.1.2-a/tests/tget_flt.c 2013-03-13 15:37:44.000000000 +0000 |
---|
| 724 | +++ mpfr-3.1.2-b/tests/tget_flt.c 2013-10-09 13:34:21.000000000 +0000 |
---|
| 725 | @@ -28,9 +28,17 @@ |
---|
| 726 | main (void) |
---|
| 727 | { |
---|
| 728 | mpfr_t x, y; |
---|
| 729 | - float f, g, infp; |
---|
| 730 | + float f, g; |
---|
| 731 | int i; |
---|
| 732 | +#if !defined(MPFR_ERRDIVZERO) |
---|
| 733 | + float infp; |
---|
| 734 | +#endif |
---|
| 735 | + |
---|
| 736 | + tests_start_mpfr (); |
---|
| 737 | |
---|
| 738 | +#if !defined(MPFR_ERRDIVZERO) |
---|
| 739 | + /* The definition of DBL_POS_INF involves a division by 0. This makes |
---|
| 740 | + "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */ |
---|
| 741 | infp = (float) DBL_POS_INF; |
---|
| 742 | if (infp * 0.5 != infp) |
---|
| 743 | { |
---|
| 744 | @@ -38,8 +46,7 @@ |
---|
| 745 | fprintf (stderr, "(this is probably a compiler bug, please report)\n"); |
---|
| 746 | exit (1); |
---|
| 747 | } |
---|
| 748 | - |
---|
| 749 | - tests_start_mpfr (); |
---|
| 750 | +#endif |
---|
| 751 | |
---|
| 752 | mpfr_init2 (x, 24); |
---|
| 753 | mpfr_init2 (y, 24); |
---|
| 754 | @@ -353,6 +360,7 @@ |
---|
| 755 | printf ("expected %.8e, got %.8e\n", g, f); |
---|
| 756 | exit (1); |
---|
| 757 | } |
---|
| 758 | +#if !defined(MPFR_ERRDIVZERO) |
---|
| 759 | f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule), |
---|
| 760 | thus we should get +Inf */ |
---|
| 761 | g = infp; |
---|
| 762 | @@ -376,6 +384,7 @@ |
---|
| 763 | printf ("expected %.8e, got %.8e\n", g, f); |
---|
| 764 | exit (1); |
---|
| 765 | } |
---|
| 766 | +#endif |
---|
| 767 | |
---|
| 768 | mpfr_clear (x); |
---|
| 769 | mpfr_clear (y); |
---|
| 770 | diff -Naurd mpfr-3.1.2-a/tests/tset_ld.c mpfr-3.1.2-b/tests/tset_ld.c |
---|
| 771 | --- mpfr-3.1.2-a/tests/tset_ld.c 2013-03-13 15:37:44.000000000 +0000 |
---|
| 772 | +++ mpfr-3.1.2-b/tests/tset_ld.c 2013-10-09 13:34:21.000000000 +0000 |
---|
| 773 | @@ -47,8 +47,11 @@ |
---|
| 774 | static int |
---|
| 775 | Isnan_ld (long double d) |
---|
| 776 | { |
---|
| 777 | - double e = (double) d; |
---|
| 778 | - if (DOUBLE_ISNAN (e)) |
---|
| 779 | + /* Do not convert d to double as this can give an overflow, which |
---|
| 780 | + may confuse compilers without IEEE 754 support (such as clang |
---|
| 781 | + -fsanitize=undefined), or trigger a trap if enabled. |
---|
| 782 | + The DOUBLE_ISNAN macro should work fine on long double. */ |
---|
| 783 | + if (DOUBLE_ISNAN (d)) |
---|
| 784 | return 1; |
---|
| 785 | LONGDOUBLE_NAN_ACTION (d, goto yes); |
---|
| 786 | return 0; |
---|
| 787 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 788 | --- mpfr-3.1.2-a/PATCHES 2013-11-15 00:51:49.211333830 +0000 |
---|
| 789 | +++ mpfr-3.1.2-b/PATCHES 2013-11-15 00:51:49.323334999 +0000 |
---|
| 790 | @@ -0,0 +1 @@ |
---|
| 791 | +printf-alt0 |
---|
| 792 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 793 | --- mpfr-3.1.2-a/VERSION 2013-11-15 00:51:49.211333830 +0000 |
---|
| 794 | +++ mpfr-3.1.2-b/VERSION 2013-11-15 00:51:49.323334999 +0000 |
---|
| 795 | @@ -1 +1 @@ |
---|
| 796 | -3.1.2-p3 |
---|
| 797 | +3.1.2-p4 |
---|
| 798 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 799 | --- mpfr-3.1.2-a/src/mpfr.h 2013-11-15 00:51:49.211333830 +0000 |
---|
| 800 | +++ mpfr-3.1.2-b/src/mpfr.h 2013-11-15 00:51:49.323334999 +0000 |
---|
| 801 | @@ -27,7 +27,7 @@ |
---|
| 802 | #define MPFR_VERSION_MAJOR 3 |
---|
| 803 | #define MPFR_VERSION_MINOR 1 |
---|
| 804 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 805 | -#define MPFR_VERSION_STRING "3.1.2-p3" |
---|
| 806 | +#define MPFR_VERSION_STRING "3.1.2-p4" |
---|
| 807 | |
---|
| 808 | /* Macros dealing with MPFR VERSION */ |
---|
| 809 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 810 | diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c |
---|
| 811 | --- mpfr-3.1.2-a/src/vasprintf.c 2013-03-13 15:37:37.000000000 +0000 |
---|
| 812 | +++ mpfr-3.1.2-b/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000 |
---|
| 813 | @@ -1040,7 +1040,7 @@ |
---|
| 814 | } |
---|
| 815 | |
---|
| 816 | /* Determine the different parts of the string representation of the regular |
---|
| 817 | - number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'. |
---|
| 818 | + number P when spec.spec is 'e', 'E', 'g', or 'G'. |
---|
| 819 | DEC_INFO contains the previously computed exponent and string or is NULL. |
---|
| 820 | |
---|
| 821 | return -1 if some field > INT_MAX */ |
---|
| 822 | @@ -1167,7 +1167,7 @@ |
---|
| 823 | } |
---|
| 824 | |
---|
| 825 | /* Determine the different parts of the string representation of the regular |
---|
| 826 | - number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'. |
---|
| 827 | + number P when spec.spec is 'f', 'F', 'g', or 'G'. |
---|
| 828 | DEC_INFO contains the previously computed exponent and string or is NULL. |
---|
| 829 | |
---|
| 830 | return -1 if some field of number_parts is greater than INT_MAX */ |
---|
| 831 | @@ -1559,7 +1559,7 @@ |
---|
| 832 | /* fractional part */ |
---|
| 833 | { |
---|
| 834 | np->point = MPFR_DECIMAL_POINT; |
---|
| 835 | - np->fp_trailing_zeros = (spec.spec == 'g' && spec.spec == 'G') ? |
---|
| 836 | + np->fp_trailing_zeros = (spec.spec == 'g' || spec.spec == 'G') ? |
---|
| 837 | spec.prec - 1 : spec.prec; |
---|
| 838 | } |
---|
| 839 | else if (spec.alt) |
---|
| 840 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 841 | --- mpfr-3.1.2-a/src/version.c 2013-11-15 00:51:49.211333830 +0000 |
---|
| 842 | +++ mpfr-3.1.2-b/src/version.c 2013-11-15 00:51:49.323334999 +0000 |
---|
| 843 | @@ -25,5 +25,5 @@ |
---|
| 844 | const char * |
---|
| 845 | mpfr_get_version (void) |
---|
| 846 | { |
---|
| 847 | - return "3.1.2-p3"; |
---|
| 848 | + return "3.1.2-p4"; |
---|
| 849 | } |
---|
| 850 | diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c |
---|
| 851 | --- mpfr-3.1.2-a/tests/tsprintf.c 2013-03-13 15:37:44.000000000 +0000 |
---|
| 852 | +++ mpfr-3.1.2-b/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000 |
---|
| 853 | @@ -456,10 +456,16 @@ |
---|
| 854 | check_sprintf ("1.999900 ", "%-#10.7RG", x); |
---|
| 855 | check_sprintf ("1.9999 ", "%-10.7RG", x); |
---|
| 856 | mpfr_set_ui (x, 1, MPFR_RNDN); |
---|
| 857 | + check_sprintf ("1.", "%#.1Rg", x); |
---|
| 858 | + check_sprintf ("1. ", "%-#5.1Rg", x); |
---|
| 859 | + check_sprintf (" 1.0", "%#5.2Rg", x); |
---|
| 860 | check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x); |
---|
| 861 | check_sprintf ("1", "%.30Rg", x); |
---|
| 862 | mpfr_set_ui (x, 0, MPFR_RNDN); |
---|
| 863 | - check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x); |
---|
| 864 | + check_sprintf ("0.", "%#.1Rg", x); |
---|
| 865 | + check_sprintf ("0. ", "%-#5.1Rg", x); |
---|
| 866 | + check_sprintf (" 0.0", "%#5.2Rg", x); |
---|
| 867 | + check_sprintf ("0.00000000000000000000000000000", "%#.30Rg", x); |
---|
| 868 | check_sprintf ("0", "%.30Rg", x); |
---|
| 869 | |
---|
| 870 | /* following tests with precision 53 bits */ |
---|
| 871 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 872 | --- mpfr-3.1.2-a/PATCHES 2013-12-01 11:07:49.575329762 +0000 |
---|
| 873 | +++ mpfr-3.1.2-b/PATCHES 2013-12-01 11:07:49.751331625 +0000 |
---|
| 874 | @@ -0,0 +1 @@ |
---|
| 875 | +custom_init_set |
---|
| 876 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 877 | --- mpfr-3.1.2-a/VERSION 2013-12-01 11:07:49.571329714 +0000 |
---|
| 878 | +++ mpfr-3.1.2-b/VERSION 2013-12-01 11:07:49.747331585 +0000 |
---|
| 879 | @@ -1 +1 @@ |
---|
| 880 | -3.1.2-p4 |
---|
| 881 | +3.1.2-p5 |
---|
| 882 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 883 | --- mpfr-3.1.2-a/src/mpfr.h 2013-12-01 11:07:49.571329714 +0000 |
---|
| 884 | +++ mpfr-3.1.2-b/src/mpfr.h 2013-12-01 11:07:49.747331585 +0000 |
---|
| 885 | @@ -27,7 +27,7 @@ |
---|
| 886 | #define MPFR_VERSION_MAJOR 3 |
---|
| 887 | #define MPFR_VERSION_MINOR 1 |
---|
| 888 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 889 | -#define MPFR_VERSION_STRING "3.1.2-p4" |
---|
| 890 | +#define MPFR_VERSION_STRING "3.1.2-p5" |
---|
| 891 | |
---|
| 892 | /* Macros dealing with MPFR VERSION */ |
---|
| 893 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 894 | @@ -861,7 +861,7 @@ |
---|
| 895 | _t = (mpfr_kind_t) _k; \ |
---|
| 896 | _s = 1; \ |
---|
| 897 | } else { \ |
---|
| 898 | - _t = (mpfr_kind_t) -k; \ |
---|
| 899 | + _t = (mpfr_kind_t) - _k; \ |
---|
| 900 | _s = -1; \ |
---|
| 901 | } \ |
---|
| 902 | _e = _t == MPFR_REGULAR_KIND ? (e) : \ |
---|
| 903 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 904 | --- mpfr-3.1.2-a/src/version.c 2013-12-01 11:07:49.575329762 +0000 |
---|
| 905 | +++ mpfr-3.1.2-b/src/version.c 2013-12-01 11:07:49.747331585 +0000 |
---|
| 906 | @@ -25,5 +25,5 @@ |
---|
| 907 | const char * |
---|
| 908 | mpfr_get_version (void) |
---|
| 909 | { |
---|
| 910 | - return "3.1.2-p4"; |
---|
| 911 | + return "3.1.2-p5"; |
---|
| 912 | } |
---|
| 913 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 914 | --- mpfr-3.1.2-a/PATCHES 2014-04-15 21:56:49.609057464 +0000 |
---|
| 915 | +++ mpfr-3.1.2-b/PATCHES 2014-04-15 21:56:49.697059857 +0000 |
---|
| 916 | @@ -0,0 +1 @@ |
---|
| 917 | +li2-return |
---|
| 918 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 919 | --- mpfr-3.1.2-a/VERSION 2014-04-15 21:56:49.609057464 +0000 |
---|
| 920 | +++ mpfr-3.1.2-b/VERSION 2014-04-15 21:56:49.697059857 +0000 |
---|
| 921 | @@ -1 +1 @@ |
---|
| 922 | -3.1.2-p5 |
---|
| 923 | +3.1.2-p6 |
---|
| 924 | diff -Naurd mpfr-3.1.2-a/src/li2.c mpfr-3.1.2-b/src/li2.c |
---|
| 925 | --- mpfr-3.1.2-a/src/li2.c 2013-03-13 15:37:32.000000000 +0000 |
---|
| 926 | +++ mpfr-3.1.2-b/src/li2.c 2014-04-15 21:56:49.653058661 +0000 |
---|
| 927 | @@ -630,5 +630,5 @@ |
---|
| 928 | return mpfr_check_range (y, inexact, rnd_mode); |
---|
| 929 | } |
---|
| 930 | |
---|
| 931 | - MPFR_ASSERTN (0); /* should never reach this point */ |
---|
| 932 | + MPFR_RET_NEVER_GO_HERE (); |
---|
| 933 | } |
---|
| 934 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 935 | --- mpfr-3.1.2-a/src/mpfr.h 2014-04-15 21:56:49.609057464 +0000 |
---|
| 936 | +++ mpfr-3.1.2-b/src/mpfr.h 2014-04-15 21:56:49.697059857 +0000 |
---|
| 937 | @@ -27,7 +27,7 @@ |
---|
| 938 | #define MPFR_VERSION_MAJOR 3 |
---|
| 939 | #define MPFR_VERSION_MINOR 1 |
---|
| 940 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 941 | -#define MPFR_VERSION_STRING "3.1.2-p5" |
---|
| 942 | +#define MPFR_VERSION_STRING "3.1.2-p6" |
---|
| 943 | |
---|
| 944 | /* Macros dealing with MPFR VERSION */ |
---|
| 945 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 946 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 947 | --- mpfr-3.1.2-a/src/version.c 2014-04-15 21:56:49.609057464 +0000 |
---|
| 948 | +++ mpfr-3.1.2-b/src/version.c 2014-04-15 21:56:49.697059857 +0000 |
---|
| 949 | @@ -25,5 +25,5 @@ |
---|
| 950 | const char * |
---|
| 951 | mpfr_get_version (void) |
---|
| 952 | { |
---|
| 953 | - return "3.1.2-p5"; |
---|
| 954 | + return "3.1.2-p6"; |
---|
| 955 | } |
---|
| 956 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 957 | --- mpfr-3.1.2-a/PATCHES 2014-04-15 22:04:57.090286262 +0000 |
---|
| 958 | +++ mpfr-3.1.2-b/PATCHES 2014-04-15 22:04:57.162288198 +0000 |
---|
| 959 | @@ -0,0 +1 @@ |
---|
| 960 | +exp3 |
---|
| 961 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 962 | --- mpfr-3.1.2-a/VERSION 2014-04-15 22:04:57.086286154 +0000 |
---|
| 963 | +++ mpfr-3.1.2-b/VERSION 2014-04-15 22:04:57.162288198 +0000 |
---|
| 964 | @@ -1 +1 @@ |
---|
| 965 | -3.1.2-p6 |
---|
| 966 | +3.1.2-p7 |
---|
| 967 | diff -Naurd mpfr-3.1.2-a/src/exp3.c mpfr-3.1.2-b/src/exp3.c |
---|
| 968 | --- mpfr-3.1.2-a/src/exp3.c 2013-03-13 15:37:34.000000000 +0000 |
---|
| 969 | +++ mpfr-3.1.2-b/src/exp3.c 2014-04-15 22:04:57.126287230 +0000 |
---|
| 970 | @@ -283,7 +283,7 @@ |
---|
| 971 | } |
---|
| 972 | } |
---|
| 973 | |
---|
| 974 | - if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDD, MPFR_RNDZ, |
---|
| 975 | + if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDN, MPFR_RNDZ, |
---|
| 976 | MPFR_PREC(y) + (rnd_mode == MPFR_RNDN))) |
---|
| 977 | { |
---|
| 978 | inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode); |
---|
| 979 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 980 | --- mpfr-3.1.2-a/src/mpfr.h 2014-04-15 22:04:57.086286154 +0000 |
---|
| 981 | +++ mpfr-3.1.2-b/src/mpfr.h 2014-04-15 22:04:57.162288198 +0000 |
---|
| 982 | @@ -27,7 +27,7 @@ |
---|
| 983 | #define MPFR_VERSION_MAJOR 3 |
---|
| 984 | #define MPFR_VERSION_MINOR 1 |
---|
| 985 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 986 | -#define MPFR_VERSION_STRING "3.1.2-p6" |
---|
| 987 | +#define MPFR_VERSION_STRING "3.1.2-p7" |
---|
| 988 | |
---|
| 989 | /* Macros dealing with MPFR VERSION */ |
---|
| 990 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 991 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 992 | --- mpfr-3.1.2-a/src/version.c 2014-04-15 22:04:57.090286262 +0000 |
---|
| 993 | +++ mpfr-3.1.2-b/src/version.c 2014-04-15 22:04:57.162288198 +0000 |
---|
| 994 | @@ -25,5 +25,5 @@ |
---|
| 995 | const char * |
---|
| 996 | mpfr_get_version (void) |
---|
| 997 | { |
---|
| 998 | - return "3.1.2-p6"; |
---|
| 999 | + return "3.1.2-p7"; |
---|
| 1000 | } |
---|
| 1001 | diff -Naurd mpfr-3.1.2-a/tests/texp.c mpfr-3.1.2-b/tests/texp.c |
---|
| 1002 | --- mpfr-3.1.2-a/tests/texp.c 2013-03-13 15:37:44.000000000 +0000 |
---|
| 1003 | +++ mpfr-3.1.2-b/tests/texp.c 2014-04-15 22:04:57.126287230 +0000 |
---|
| 1004 | @@ -150,6 +150,22 @@ |
---|
| 1005 | exit (1); |
---|
| 1006 | } |
---|
| 1007 | |
---|
| 1008 | + mpfr_set_prec (x, 118); |
---|
| 1009 | + mpfr_set_str_binary (x, "0.1110010100011101010000111110011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E-86"); |
---|
| 1010 | + mpfr_set_prec (y, 118); |
---|
| 1011 | + mpfr_exp_2 (y, x, MPFR_RNDU); |
---|
| 1012 | + mpfr_exp_3 (x, x, MPFR_RNDU); |
---|
| 1013 | + if (mpfr_cmp (x, y)) |
---|
| 1014 | + { |
---|
| 1015 | + printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=118\n"); |
---|
| 1016 | + printf ("mpfr_exp_2 gives "); |
---|
| 1017 | + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); |
---|
| 1018 | + printf ("\nmpfr_exp_3 gives "); |
---|
| 1019 | + mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); |
---|
| 1020 | + printf ("\n"); |
---|
| 1021 | + exit (1); |
---|
| 1022 | + } |
---|
| 1023 | + |
---|
| 1024 | mpfr_clear (x); |
---|
| 1025 | mpfr_clear (y); |
---|
| 1026 | return 0; |
---|
| 1027 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 1028 | --- mpfr-3.1.2-a/PATCHES 2014-04-15 22:20:32.243481506 +0000 |
---|
| 1029 | +++ mpfr-3.1.2-b/PATCHES 2014-04-15 22:22:32.418722707 +0000 |
---|
| 1030 | @@ -0,0 +1 @@ |
---|
| 1031 | +gmp6-compat |
---|
| 1032 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 1033 | --- mpfr-3.1.2-a/VERSION 2014-04-15 22:20:20.755171478 +0000 |
---|
| 1034 | +++ mpfr-3.1.2-b/VERSION 2014-04-15 22:21:45.225450147 +0000 |
---|
| 1035 | @@ -1 +1 @@ |
---|
| 1036 | -3.1.2-p7 |
---|
| 1037 | +3.1.2-p8 |
---|
| 1038 | diff -Naurd mpfr-3.1.2-a/configure mpfr-3.1.2-b/configure |
---|
| 1039 | --- mpfr-3.1.2-a/configure 2013-03-13 15:38:20.000000000 +0000 |
---|
| 1040 | +++ mpfr-3.1.2-b/configure 2014-04-15 22:21:38.821277476 +0000 |
---|
| 1041 | @@ -14545,26 +14545,30 @@ |
---|
| 1042 | rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext |
---|
| 1043 | fi |
---|
| 1044 | |
---|
| 1045 | -if test "$use_gmp_build" = yes ; then |
---|
| 1046 | - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for valid GMP_NUMB_BITS" >&5 |
---|
| 1047 | -$as_echo_n "checking for valid GMP_NUMB_BITS... " >&6; } |
---|
| 1048 | - if test "$cross_compiling" = yes; then : |
---|
| 1049 | +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency" >&5 |
---|
| 1050 | +$as_echo_n "checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... " >&6; } |
---|
| 1051 | +if test "$cross_compiling" = yes; then : |
---|
| 1052 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: can't test" >&5 |
---|
| 1053 | $as_echo "can't test" >&6; } |
---|
| 1054 | else |
---|
| 1055 | cat confdefs.h - <<_ACEOF >conftest.$ac_ext |
---|
| 1056 | /* end confdefs.h. */ |
---|
| 1057 | |
---|
| 1058 | +#include <stdio.h> |
---|
| 1059 | #include <limits.h> |
---|
| 1060 | #include "gmp.h" |
---|
| 1061 | -#include "gmp-impl.h" |
---|
| 1062 | |
---|
| 1063 | int |
---|
| 1064 | main () |
---|
| 1065 | { |
---|
| 1066 | |
---|
| 1067 | - return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT |
---|
| 1068 | - && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; |
---|
| 1069 | + if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT) |
---|
| 1070 | + return 0; |
---|
| 1071 | + fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS); |
---|
| 1072 | + fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t)); |
---|
| 1073 | + fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n", |
---|
| 1074 | + (long) (sizeof(mp_limb_t) * CHAR_BIT)); |
---|
| 1075 | + return 1; |
---|
| 1076 | |
---|
| 1077 | ; |
---|
| 1078 | return 0; |
---|
| 1079 | @@ -14577,14 +14581,14 @@ |
---|
| 1080 | |
---|
| 1081 | { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 |
---|
| 1082 | $as_echo "no" >&6; } |
---|
| 1083 | - as_fn_error $? "GMP_NUMB_BITS is incorrect. |
---|
| 1084 | -You probably need to change some of the GMP or MPFR compile options." "$LINENO" 5 |
---|
| 1085 | + as_fn_error $? "GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent. |
---|
| 1086 | +You probably need to change some of the GMP or MPFR compile options. |
---|
| 1087 | +See 'config.log' for details (search for GMP_NUMB_BITS)." "$LINENO" 5 |
---|
| 1088 | fi |
---|
| 1089 | rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ |
---|
| 1090 | conftest.$ac_objext conftest.beam conftest.$ac_ext |
---|
| 1091 | fi |
---|
| 1092 | |
---|
| 1093 | -fi |
---|
| 1094 | |
---|
| 1095 | |
---|
| 1096 | if test "$dont_link_with_gmp" = yes ; then |
---|
| 1097 | diff -Naurd mpfr-3.1.2-a/configure.ac mpfr-3.1.2-b/configure.ac |
---|
| 1098 | --- mpfr-3.1.2-a/configure.ac 2013-03-13 15:37:46.000000000 +0000 |
---|
| 1099 | +++ mpfr-3.1.2-b/configure.ac 2013-03-13 15:37:46.000000000 +0000 |
---|
| 1100 | @@ -435,23 +435,29 @@ |
---|
| 1101 | ]) |
---|
| 1102 | fi |
---|
| 1103 | |
---|
| 1104 | -dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB |
---|
| 1105 | +dnl Check for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency. |
---|
| 1106 | +dnl Problems may occur if gmp.h was generated with some ABI |
---|
| 1107 | +dnl and is used with another ABI (or if nails are used). |
---|
| 1108 | dnl This test doesn't need to link with libgmp (at least it shouldn't). |
---|
| 1109 | -if test "$use_gmp_build" = yes ; then |
---|
| 1110 | - AC_MSG_CHECKING(for valid GMP_NUMB_BITS) |
---|
| 1111 | - AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
---|
| 1112 | +AC_MSG_CHECKING(for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency) |
---|
| 1113 | +AC_RUN_IFELSE([AC_LANG_PROGRAM([[ |
---|
| 1114 | +#include <stdio.h> |
---|
| 1115 | #include <limits.h> |
---|
| 1116 | #include "gmp.h" |
---|
| 1117 | -#include "gmp-impl.h" |
---|
| 1118 | ]], [[ |
---|
| 1119 | - return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT |
---|
| 1120 | - && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; |
---|
| 1121 | + if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT) |
---|
| 1122 | + return 0; |
---|
| 1123 | + fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS); |
---|
| 1124 | + fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t)); |
---|
| 1125 | + fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n", |
---|
| 1126 | + (long) (sizeof(mp_limb_t) * CHAR_BIT)); |
---|
| 1127 | + return 1; |
---|
| 1128 | ]])], [AC_MSG_RESULT(yes)], [ |
---|
| 1129 | AC_MSG_RESULT(no) |
---|
| 1130 | - AC_MSG_ERROR([GMP_NUMB_BITS is incorrect. |
---|
| 1131 | -You probably need to change some of the GMP or MPFR compile options.])], |
---|
| 1132 | + AC_MSG_ERROR([GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent. |
---|
| 1133 | +You probably need to change some of the GMP or MPFR compile options. |
---|
| 1134 | +See 'config.log' for details (search for GMP_NUMB_BITS).])], |
---|
| 1135 | [AC_MSG_RESULT([can't test])]) |
---|
| 1136 | -fi |
---|
| 1137 | |
---|
| 1138 | |
---|
| 1139 | dnl We really need to link using libtool. But it is impossible with the current |
---|
| 1140 | diff -Naurd mpfr-3.1.2-a/src/init2.c mpfr-3.1.2-b/src/init2.c |
---|
| 1141 | --- mpfr-3.1.2-a/src/init2.c 2013-03-13 15:37:32.000000000 +0000 |
---|
| 1142 | +++ mpfr-3.1.2-b/src/init2.c 2014-04-15 22:21:06.220398489 +0000 |
---|
| 1143 | @@ -30,11 +30,11 @@ |
---|
| 1144 | |
---|
| 1145 | /* Check if we can represent the number of limbs |
---|
| 1146 | * associated to the maximum of mpfr_prec_t*/ |
---|
| 1147 | - MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/BYTES_PER_MP_LIMB) ); |
---|
| 1148 | + MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/MPFR_BYTES_PER_MP_LIMB) ); |
---|
| 1149 | |
---|
| 1150 | - /* Check for correct GMP_NUMB_BITS and BYTES_PER_MP_LIMB */ |
---|
| 1151 | - MPFR_ASSERTN( GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT |
---|
| 1152 | - && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ); |
---|
| 1153 | + /* Check for correct GMP_NUMB_BITS and MPFR_BYTES_PER_MP_LIMB */ |
---|
| 1154 | + MPFR_ASSERTN( GMP_NUMB_BITS == MPFR_BYTES_PER_MP_LIMB * CHAR_BIT |
---|
| 1155 | + && sizeof(mp_limb_t) == MPFR_BYTES_PER_MP_LIMB ); |
---|
| 1156 | |
---|
| 1157 | MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS); |
---|
| 1158 | |
---|
| 1159 | diff -Naurd mpfr-3.1.2-a/src/mpfr-gmp.h mpfr-3.1.2-b/src/mpfr-gmp.h |
---|
| 1160 | --- mpfr-3.1.2-a/src/mpfr-gmp.h 2013-03-13 15:37:32.000000000 +0000 |
---|
| 1161 | +++ mpfr-3.1.2-b/src/mpfr-gmp.h 2014-04-15 22:21:06.220398489 +0000 |
---|
| 1162 | @@ -72,7 +72,6 @@ |
---|
| 1163 | #endif |
---|
| 1164 | |
---|
| 1165 | /* Define some macros */ |
---|
| 1166 | -#define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) |
---|
| 1167 | |
---|
| 1168 | #define MP_LIMB_T_MAX (~(mp_limb_t)0) |
---|
| 1169 | |
---|
| 1170 | @@ -96,19 +95,19 @@ |
---|
| 1171 | #define SHRT_HIGHBIT SHRT_MIN |
---|
| 1172 | |
---|
| 1173 | /* MP_LIMB macros */ |
---|
| 1174 | -#define MPN_ZERO(dst, n) memset((dst), 0, (n)*BYTES_PER_MP_LIMB) |
---|
| 1175 | -#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB) |
---|
| 1176 | -#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*BYTES_PER_MP_LIMB) |
---|
| 1177 | +#define MPN_ZERO(dst, n) memset((dst), 0, (n)*MPFR_BYTES_PER_MP_LIMB) |
---|
| 1178 | +#define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) |
---|
| 1179 | +#define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) |
---|
| 1180 | #define MPN_COPY(dst,src,n) \ |
---|
| 1181 | do \ |
---|
| 1182 | { \ |
---|
| 1183 | if ((dst) != (src)) \ |
---|
| 1184 | { \ |
---|
| 1185 | MPFR_ASSERTD ((char *) (dst) >= (char *) (src) + \ |
---|
| 1186 | - (n) * BYTES_PER_MP_LIMB || \ |
---|
| 1187 | + (n) * MPFR_BYTES_PER_MP_LIMB || \ |
---|
| 1188 | (char *) (src) >= (char *) (dst) + \ |
---|
| 1189 | - (n) * BYTES_PER_MP_LIMB); \ |
---|
| 1190 | - memcpy ((dst), (src), (n) * BYTES_PER_MP_LIMB); \ |
---|
| 1191 | + (n) * MPFR_BYTES_PER_MP_LIMB); \ |
---|
| 1192 | + memcpy ((dst), (src), (n) * MPFR_BYTES_PER_MP_LIMB); \ |
---|
| 1193 | } \ |
---|
| 1194 | } \ |
---|
| 1195 | while (0) |
---|
| 1196 | diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h |
---|
| 1197 | --- mpfr-3.1.2-a/src/mpfr-impl.h 2013-10-09 13:34:21.000000000 +0000 |
---|
| 1198 | +++ mpfr-3.1.2-b/src/mpfr-impl.h 2014-04-15 22:21:06.220398489 +0000 |
---|
| 1199 | @@ -191,7 +191,7 @@ |
---|
| 1200 | # endif |
---|
| 1201 | #endif |
---|
| 1202 | |
---|
| 1203 | - |
---|
| 1204 | +#define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) |
---|
| 1205 | |
---|
| 1206 | /****************************************************** |
---|
| 1207 | ******************** Check GMP *********************** |
---|
| 1208 | @@ -930,7 +930,7 @@ |
---|
| 1209 | #define MPFR_SET_ALLOC_SIZE(x, n) \ |
---|
| 1210 | ( ((mp_size_t*) MPFR_MANT(x))[-1] = n) |
---|
| 1211 | #define MPFR_MALLOC_SIZE(s) \ |
---|
| 1212 | - ( sizeof(mpfr_size_limb_t) + BYTES_PER_MP_LIMB * ((size_t) s) ) |
---|
| 1213 | + ( sizeof(mpfr_size_limb_t) + MPFR_BYTES_PER_MP_LIMB * ((size_t) s) ) |
---|
| 1214 | #define MPFR_SET_MANT_PTR(x,p) \ |
---|
| 1215 | (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1)) |
---|
| 1216 | #define MPFR_GET_REAL_PTR(x) \ |
---|
| 1217 | @@ -964,7 +964,7 @@ |
---|
| 1218 | #endif |
---|
| 1219 | |
---|
| 1220 | #define MPFR_TMP_LIMBS_ALLOC(N) \ |
---|
| 1221 | - ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * BYTES_PER_MP_LIMB)) |
---|
| 1222 | + ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * MPFR_BYTES_PER_MP_LIMB)) |
---|
| 1223 | |
---|
| 1224 | /* temporary allocate 1 limb at xp, and initialize mpfr variable x */ |
---|
| 1225 | /* The temporary var doesn't have any size field, but it doesn't matter |
---|
| 1226 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 1227 | --- mpfr-3.1.2-a/src/mpfr.h 2014-04-15 22:20:20.755171478 +0000 |
---|
| 1228 | +++ mpfr-3.1.2-b/src/mpfr.h 2014-04-15 22:21:45.225450147 +0000 |
---|
| 1229 | @@ -27,7 +27,7 @@ |
---|
| 1230 | #define MPFR_VERSION_MAJOR 3 |
---|
| 1231 | #define MPFR_VERSION_MINOR 1 |
---|
| 1232 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 1233 | -#define MPFR_VERSION_STRING "3.1.2-p7" |
---|
| 1234 | +#define MPFR_VERSION_STRING "3.1.2-p8" |
---|
| 1235 | |
---|
| 1236 | /* Macros dealing with MPFR VERSION */ |
---|
| 1237 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 1238 | diff -Naurd mpfr-3.1.2-a/src/mul.c mpfr-3.1.2-b/src/mul.c |
---|
| 1239 | --- mpfr-3.1.2-a/src/mul.c 2013-03-13 15:37:37.000000000 +0000 |
---|
| 1240 | +++ mpfr-3.1.2-b/src/mul.c 2014-04-15 22:21:06.224398597 +0000 |
---|
| 1241 | @@ -106,7 +106,7 @@ |
---|
| 1242 | MPFR_ASSERTD(tn <= k); |
---|
| 1243 | |
---|
| 1244 | /* Check for no size_t overflow*/ |
---|
| 1245 | - MPFR_ASSERTD((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB); |
---|
| 1246 | + MPFR_ASSERTD((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); |
---|
| 1247 | MPFR_TMP_MARK(marker); |
---|
| 1248 | tmp = MPFR_TMP_LIMBS_ALLOC (k); |
---|
| 1249 | |
---|
| 1250 | @@ -301,7 +301,7 @@ |
---|
| 1251 | MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */ |
---|
| 1252 | |
---|
| 1253 | /* Check for no size_t overflow*/ |
---|
| 1254 | - MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB); |
---|
| 1255 | + MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); |
---|
| 1256 | MPFR_TMP_MARK (marker); |
---|
| 1257 | tmp = MPFR_TMP_LIMBS_ALLOC (k); |
---|
| 1258 | |
---|
| 1259 | diff -Naurd mpfr-3.1.2-a/src/stack_interface.c mpfr-3.1.2-b/src/stack_interface.c |
---|
| 1260 | --- mpfr-3.1.2-a/src/stack_interface.c 2013-03-13 15:37:32.000000000 +0000 |
---|
| 1261 | +++ mpfr-3.1.2-b/src/stack_interface.c 2014-04-15 22:21:06.220398489 +0000 |
---|
| 1262 | @@ -26,7 +26,7 @@ |
---|
| 1263 | size_t |
---|
| 1264 | mpfr_custom_get_size (mpfr_prec_t prec) |
---|
| 1265 | { |
---|
| 1266 | - return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB; |
---|
| 1267 | + return MPFR_PREC2LIMBS (prec) * MPFR_BYTES_PER_MP_LIMB; |
---|
| 1268 | } |
---|
| 1269 | |
---|
| 1270 | #undef mpfr_custom_init |
---|
| 1271 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 1272 | --- mpfr-3.1.2-a/src/version.c 2014-04-15 22:20:20.755171478 +0000 |
---|
| 1273 | +++ mpfr-3.1.2-b/src/version.c 2014-04-15 22:21:45.225450147 +0000 |
---|
| 1274 | @@ -25,5 +25,5 @@ |
---|
| 1275 | const char * |
---|
| 1276 | mpfr_get_version (void) |
---|
| 1277 | { |
---|
| 1278 | - return "3.1.2-p7"; |
---|
| 1279 | + return "3.1.2-p8"; |
---|
| 1280 | } |
---|
| 1281 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 1282 | --- mpfr-3.1.2-a/PATCHES 2014-06-30 15:15:25.533266905 +0000 |
---|
| 1283 | +++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:15:25.617269178 +0000 |
---|
| 1284 | @@ -0,0 +1 @@ |
---|
| 1285 | +div-overflow |
---|
| 1286 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 1287 | --- mpfr-3.1.2-a/VERSION 2014-06-30 15:15:25.529266797 +0000 |
---|
| 1288 | +++ mpfr-3.1.2-b/VERSION 2014-06-30 15:15:25.617269178 +0000 |
---|
| 1289 | @@ -1 +1 @@ |
---|
| 1290 | -3.1.2-p8 |
---|
| 1291 | +3.1.2-p9 |
---|
| 1292 | diff -Naurd mpfr-3.1.2-a/src/div.c mpfr-3.1.2-b/src/div.c |
---|
| 1293 | --- mpfr-3.1.2-a/src/div.c 2013-03-13 15:37:33.000000000 +0000 |
---|
| 1294 | +++ mpfr-3.1.2-b/src/div.c 2014-06-30 15:15:25.585268312 +0000 |
---|
| 1295 | @@ -750,7 +750,9 @@ |
---|
| 1296 | truncate_check_qh: |
---|
| 1297 | if (qh) |
---|
| 1298 | { |
---|
| 1299 | - qexp ++; |
---|
| 1300 | + if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) |
---|
| 1301 | + qexp ++; |
---|
| 1302 | + /* else qexp is now incorrect, but one will still get an overflow */ |
---|
| 1303 | q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; |
---|
| 1304 | } |
---|
| 1305 | goto truncate; |
---|
| 1306 | @@ -765,7 +767,9 @@ |
---|
| 1307 | inex = 1; /* always here */ |
---|
| 1308 | if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh)) |
---|
| 1309 | { |
---|
| 1310 | - qexp ++; |
---|
| 1311 | + if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) |
---|
| 1312 | + qexp ++; |
---|
| 1313 | + /* else qexp is now incorrect, but one will still get an overflow */ |
---|
| 1314 | q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; |
---|
| 1315 | } |
---|
| 1316 | |
---|
| 1317 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 1318 | --- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:15:25.533266905 +0000 |
---|
| 1319 | +++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:15:25.613269070 +0000 |
---|
| 1320 | @@ -27,7 +27,7 @@ |
---|
| 1321 | #define MPFR_VERSION_MAJOR 3 |
---|
| 1322 | #define MPFR_VERSION_MINOR 1 |
---|
| 1323 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 1324 | -#define MPFR_VERSION_STRING "3.1.2-p8" |
---|
| 1325 | +#define MPFR_VERSION_STRING "3.1.2-p9" |
---|
| 1326 | |
---|
| 1327 | /* Macros dealing with MPFR VERSION */ |
---|
| 1328 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 1329 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 1330 | --- mpfr-3.1.2-a/src/version.c 2014-06-30 15:15:25.533266905 +0000 |
---|
| 1331 | +++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:15:25.613269070 +0000 |
---|
| 1332 | @@ -25,5 +25,5 @@ |
---|
| 1333 | const char * |
---|
| 1334 | mpfr_get_version (void) |
---|
| 1335 | { |
---|
| 1336 | - return "3.1.2-p8"; |
---|
| 1337 | + return "3.1.2-p9"; |
---|
| 1338 | } |
---|
| 1339 | diff -Naurd mpfr-3.1.2-a/tests/tdiv.c mpfr-3.1.2-b/tests/tdiv.c |
---|
| 1340 | --- mpfr-3.1.2-a/tests/tdiv.c 2013-03-13 15:37:44.000000000 +0000 |
---|
| 1341 | +++ mpfr-3.1.2-b/tests/tdiv.c 2014-06-30 15:15:25.585268312 +0000 |
---|
| 1342 | @@ -1104,6 +1104,96 @@ |
---|
| 1343 | #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) |
---|
| 1344 | #include "tgeneric.c" |
---|
| 1345 | |
---|
| 1346 | +static void |
---|
| 1347 | +test_extreme (void) |
---|
| 1348 | +{ |
---|
| 1349 | + mpfr_t x, y, z; |
---|
| 1350 | + mpfr_exp_t emin, emax; |
---|
| 1351 | + mpfr_prec_t p[4] = { 8, 32, 64, 256 }; |
---|
| 1352 | + int xi, yi, zi, j, r; |
---|
| 1353 | + unsigned int flags, ex_flags; |
---|
| 1354 | + |
---|
| 1355 | + emin = mpfr_get_emin (); |
---|
| 1356 | + emax = mpfr_get_emax (); |
---|
| 1357 | + |
---|
| 1358 | + mpfr_set_emin (MPFR_EMIN_MIN); |
---|
| 1359 | + mpfr_set_emax (MPFR_EMAX_MAX); |
---|
| 1360 | + |
---|
| 1361 | + for (xi = 0; xi < 4; xi++) |
---|
| 1362 | + { |
---|
| 1363 | + mpfr_init2 (x, p[xi]); |
---|
| 1364 | + mpfr_setmax (x, MPFR_EMAX_MAX); |
---|
| 1365 | + MPFR_ASSERTN (mpfr_check (x)); |
---|
| 1366 | + for (yi = 0; yi < 4; yi++) |
---|
| 1367 | + { |
---|
| 1368 | + mpfr_init2 (y, p[yi]); |
---|
| 1369 | + mpfr_setmin (y, MPFR_EMIN_MIN); |
---|
| 1370 | + for (j = 0; j < 2; j++) |
---|
| 1371 | + { |
---|
| 1372 | + MPFR_ASSERTN (mpfr_check (y)); |
---|
| 1373 | + for (zi = 0; zi < 4; zi++) |
---|
| 1374 | + { |
---|
| 1375 | + mpfr_init2 (z, p[zi]); |
---|
| 1376 | + RND_LOOP (r) |
---|
| 1377 | + { |
---|
| 1378 | + mpfr_clear_flags (); |
---|
| 1379 | + mpfr_div (z, x, y, (mpfr_rnd_t) r); |
---|
| 1380 | + flags = __gmpfr_flags; |
---|
| 1381 | + MPFR_ASSERTN (mpfr_check (z)); |
---|
| 1382 | + ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; |
---|
| 1383 | + if (flags != ex_flags) |
---|
| 1384 | + { |
---|
| 1385 | + printf ("Bad flags in test_extreme on z = a/b" |
---|
| 1386 | + " with %s and\n", |
---|
| 1387 | + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); |
---|
| 1388 | + printf ("a = "); |
---|
| 1389 | + mpfr_dump (x); |
---|
| 1390 | + printf ("b = "); |
---|
| 1391 | + mpfr_dump (y); |
---|
| 1392 | + printf ("Expected flags:"); |
---|
| 1393 | + flags_out (ex_flags); |
---|
| 1394 | + printf ("Got flags: "); |
---|
| 1395 | + flags_out (flags); |
---|
| 1396 | + printf ("z = "); |
---|
| 1397 | + mpfr_dump (z); |
---|
| 1398 | + exit (1); |
---|
| 1399 | + } |
---|
| 1400 | + mpfr_clear_flags (); |
---|
| 1401 | + mpfr_div (z, y, x, (mpfr_rnd_t) r); |
---|
| 1402 | + flags = __gmpfr_flags; |
---|
| 1403 | + MPFR_ASSERTN (mpfr_check (z)); |
---|
| 1404 | + ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; |
---|
| 1405 | + if (flags != ex_flags) |
---|
| 1406 | + { |
---|
| 1407 | + printf ("Bad flags in test_extreme on z = a/b" |
---|
| 1408 | + " with %s and\n", |
---|
| 1409 | + mpfr_print_rnd_mode ((mpfr_rnd_t) r)); |
---|
| 1410 | + printf ("a = "); |
---|
| 1411 | + mpfr_dump (y); |
---|
| 1412 | + printf ("b = "); |
---|
| 1413 | + mpfr_dump (x); |
---|
| 1414 | + printf ("Expected flags:"); |
---|
| 1415 | + flags_out (ex_flags); |
---|
| 1416 | + printf ("Got flags: "); |
---|
| 1417 | + flags_out (flags); |
---|
| 1418 | + printf ("z = "); |
---|
| 1419 | + mpfr_dump (z); |
---|
| 1420 | + exit (1); |
---|
| 1421 | + } |
---|
| 1422 | + } |
---|
| 1423 | + mpfr_clear (z); |
---|
| 1424 | + } /* zi */ |
---|
| 1425 | + mpfr_nextabove (y); |
---|
| 1426 | + } /* j */ |
---|
| 1427 | + mpfr_clear (y); |
---|
| 1428 | + } /* yi */ |
---|
| 1429 | + mpfr_clear (x); |
---|
| 1430 | + } /* xi */ |
---|
| 1431 | + |
---|
| 1432 | + set_emin (emin); |
---|
| 1433 | + set_emax (emax); |
---|
| 1434 | +} |
---|
| 1435 | + |
---|
| 1436 | int |
---|
| 1437 | main (int argc, char *argv[]) |
---|
| 1438 | { |
---|
| 1439 | @@ -1130,6 +1220,7 @@ |
---|
| 1440 | test_20070603 (); |
---|
| 1441 | test_20070628 (); |
---|
| 1442 | test_generic (2, 800, 50); |
---|
| 1443 | + test_extreme (); |
---|
| 1444 | |
---|
| 1445 | tests_end_mpfr (); |
---|
| 1446 | return 0; |
---|
| 1447 | diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES |
---|
| 1448 | --- mpfr-3.1.2-a/PATCHES 2014-06-30 15:17:53.337268149 +0000 |
---|
| 1449 | +++ mpfr-3.1.2-b/PATCHES 2014-06-30 15:17:53.417270314 +0000 |
---|
| 1450 | @@ -0,0 +1 @@ |
---|
| 1451 | +vasprintf |
---|
| 1452 | diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION |
---|
| 1453 | --- mpfr-3.1.2-a/VERSION 2014-06-30 15:17:53.337268149 +0000 |
---|
| 1454 | +++ mpfr-3.1.2-b/VERSION 2014-06-30 15:17:53.413270206 +0000 |
---|
| 1455 | @@ -1 +1 @@ |
---|
| 1456 | -3.1.2-p9 |
---|
| 1457 | +3.1.2-p10 |
---|
| 1458 | diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h |
---|
| 1459 | --- mpfr-3.1.2-a/src/mpfr.h 2014-06-30 15:17:53.337268149 +0000 |
---|
| 1460 | +++ mpfr-3.1.2-b/src/mpfr.h 2014-06-30 15:17:53.413270206 +0000 |
---|
| 1461 | @@ -27,7 +27,7 @@ |
---|
| 1462 | #define MPFR_VERSION_MAJOR 3 |
---|
| 1463 | #define MPFR_VERSION_MINOR 1 |
---|
| 1464 | #define MPFR_VERSION_PATCHLEVEL 2 |
---|
| 1465 | -#define MPFR_VERSION_STRING "3.1.2-p9" |
---|
| 1466 | +#define MPFR_VERSION_STRING "3.1.2-p10" |
---|
| 1467 | |
---|
| 1468 | /* Macros dealing with MPFR VERSION */ |
---|
| 1469 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 1470 | diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c |
---|
| 1471 | --- mpfr-3.1.2-a/src/vasprintf.c 2013-11-15 00:51:49.267334408 +0000 |
---|
| 1472 | +++ mpfr-3.1.2-b/src/vasprintf.c 2014-06-30 15:17:53.377269231 +0000 |
---|
| 1473 | @@ -884,14 +884,18 @@ |
---|
| 1474 | first digit, we want the exponent for radix two and the decimal |
---|
| 1475 | point AFTER the first digit. */ |
---|
| 1476 | { |
---|
| 1477 | - MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */ |
---|
| 1478 | + /* An integer overflow is normally not possible since MPFR_EXP_MIN |
---|
| 1479 | + is twice as large as MPFR_EMIN_MIN. */ |
---|
| 1480 | + MPFR_ASSERTN (exp > (MPFR_EXP_MIN + 3) / 4); |
---|
| 1481 | exp = (exp - 1) * 4; |
---|
| 1482 | } |
---|
| 1483 | else |
---|
| 1484 | /* EXP is the exponent for decimal point BEFORE the first digit, we |
---|
| 1485 | want the exponent for decimal point AFTER the first digit. */ |
---|
| 1486 | { |
---|
| 1487 | - MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */ |
---|
| 1488 | + /* An integer overflow is normally not possible since MPFR_EXP_MIN |
---|
| 1489 | + is twice as large as MPFR_EMIN_MIN. */ |
---|
| 1490 | + MPFR_ASSERTN (exp > MPFR_EXP_MIN); |
---|
| 1491 | --exp; |
---|
| 1492 | } |
---|
| 1493 | } |
---|
| 1494 | diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c |
---|
| 1495 | --- mpfr-3.1.2-a/src/version.c 2014-06-30 15:17:53.337268149 +0000 |
---|
| 1496 | +++ mpfr-3.1.2-b/src/version.c 2014-06-30 15:17:53.413270206 +0000 |
---|
| 1497 | @@ -25,5 +25,5 @@ |
---|
| 1498 | const char * |
---|
| 1499 | mpfr_get_version (void) |
---|
| 1500 | { |
---|
| 1501 | - return "3.1.2-p9"; |
---|
| 1502 | + return "3.1.2-p10"; |
---|
| 1503 | } |
---|
| 1504 | diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c |
---|
| 1505 | --- mpfr-3.1.2-a/tests/tsprintf.c 2013-11-15 00:51:49.267334408 +0000 |
---|
| 1506 | +++ mpfr-3.1.2-b/tests/tsprintf.c 2014-06-30 15:17:53.377269231 +0000 |
---|
| 1507 | @@ -1184,6 +1184,69 @@ |
---|
| 1508 | check_emax_aux (MPFR_EMAX_MAX); |
---|
| 1509 | } |
---|
| 1510 | |
---|
| 1511 | +static void |
---|
| 1512 | +check_emin_aux (mpfr_exp_t e) |
---|
| 1513 | +{ |
---|
| 1514 | + mpfr_t x; |
---|
| 1515 | + char *s1, s2[256]; |
---|
| 1516 | + int i; |
---|
| 1517 | + mpfr_exp_t emin; |
---|
| 1518 | + mpz_t ee; |
---|
| 1519 | + |
---|
| 1520 | + MPFR_ASSERTN (e >= LONG_MIN); |
---|
| 1521 | + emin = mpfr_get_emin (); |
---|
| 1522 | + set_emin (e); |
---|
| 1523 | + |
---|
| 1524 | + mpfr_init2 (x, 16); |
---|
| 1525 | + mpz_init (ee); |
---|
| 1526 | + |
---|
| 1527 | + mpfr_setmin (x, e); |
---|
| 1528 | + mpz_set_si (ee, e); |
---|
| 1529 | + mpz_sub_ui (ee, ee, 1); |
---|
| 1530 | + |
---|
| 1531 | + i = mpfr_asprintf (&s1, "%Ra", x); |
---|
| 1532 | + MPFR_ASSERTN (i > 0); |
---|
| 1533 | + |
---|
| 1534 | + gmp_snprintf (s2, 256, "0x1p%Zd", ee); |
---|
| 1535 | + |
---|
| 1536 | + if (strcmp (s1, s2) != 0) |
---|
| 1537 | + { |
---|
| 1538 | + printf ("Error in check_emin_aux for emin = %ld\n", (long) e); |
---|
| 1539 | + printf ("Expected %s\n", s2); |
---|
| 1540 | + printf ("Got %s\n", s1); |
---|
| 1541 | + exit (1); |
---|
| 1542 | + } |
---|
| 1543 | + |
---|
| 1544 | + mpfr_free_str (s1); |
---|
| 1545 | + |
---|
| 1546 | + i = mpfr_asprintf (&s1, "%Rb", x); |
---|
| 1547 | + MPFR_ASSERTN (i > 0); |
---|
| 1548 | + |
---|
| 1549 | + gmp_snprintf (s2, 256, "1p%Zd", ee); |
---|
| 1550 | + |
---|
| 1551 | + if (strcmp (s1, s2) != 0) |
---|
| 1552 | + { |
---|
| 1553 | + printf ("Error in check_emin_aux for emin = %ld\n", (long) e); |
---|
| 1554 | + printf ("Expected %s\n", s2); |
---|
| 1555 | + printf ("Got %s\n", s1); |
---|
| 1556 | + exit (1); |
---|
| 1557 | + } |
---|
| 1558 | + |
---|
| 1559 | + mpfr_free_str (s1); |
---|
| 1560 | + |
---|
| 1561 | + mpfr_clear (x); |
---|
| 1562 | + mpz_clear (ee); |
---|
| 1563 | + set_emin (emin); |
---|
| 1564 | +} |
---|
| 1565 | + |
---|
| 1566 | +static void |
---|
| 1567 | +check_emin (void) |
---|
| 1568 | +{ |
---|
| 1569 | + check_emin_aux (-15); |
---|
| 1570 | + check_emin_aux (mpfr_get_emin ()); |
---|
| 1571 | + check_emin_aux (MPFR_EMIN_MIN); |
---|
| 1572 | +} |
---|
| 1573 | + |
---|
| 1574 | int |
---|
| 1575 | main (int argc, char **argv) |
---|
| 1576 | { |
---|
| 1577 | @@ -1203,6 +1266,7 @@ |
---|
| 1578 | decimal (); |
---|
| 1579 | mixed (); |
---|
| 1580 | check_emax (); |
---|
| 1581 | + check_emin (); |
---|
| 1582 | |
---|
| 1583 | #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) |
---|
| 1584 | locale_da_DK (); |
---|