wok-6.x diff mpfr/stuff/mpfr-3.0.1.patch @ rev 12114
Firefox: use DuckDuckGo as default search engine
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Mar 13 09:11:53 2012 +0100 (2012-03-13) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mpfr/stuff/mpfr-3.0.1.patch Tue Mar 13 09:11:53 2012 +0100 1.3 @@ -0,0 +1,367 @@ 1.4 +diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES 1.5 +--- mpfr-3.0.1-a/PATCHES 2011-04-12 10:50:02.000000000 +0000 1.6 ++++ mpfr-3.0.1-b/PATCHES 2011-04-12 10:50:02.000000000 +0000 1.7 +@@ -0,0 +1 @@ 1.8 ++asin_exprange 1.9 +diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION 1.10 +--- mpfr-3.0.1-a/VERSION 2011-04-04 10:19:18.000000000 +0000 1.11 ++++ mpfr-3.0.1-b/VERSION 2011-04-12 10:50:02.000000000 +0000 1.12 +@@ -1 +1 @@ 1.13 +-3.0.1 1.14 ++3.0.1-p1 1.15 +diff -Naurd mpfr-3.0.1-a/asin.c mpfr-3.0.1-b/asin.c 1.16 +--- mpfr-3.0.1-a/asin.c 2011-04-04 10:19:18.000000000 +0000 1.17 ++++ mpfr-3.0.1-b/asin.c 2011-04-12 10:50:02.000000000 +0000 1.18 +@@ -63,11 +63,14 @@ 1.19 + 1.20 + compared = mpfr_cmp_ui (xp, 1); 1.21 + 1.22 ++ MPFR_SAVE_EXPO_MARK (expo); 1.23 ++ 1.24 + if (MPFR_UNLIKELY (compared >= 0)) 1.25 + { 1.26 + mpfr_clear (xp); 1.27 + if (compared > 0) /* asin(x) = NaN for |x| > 1 */ 1.28 + { 1.29 ++ MPFR_SAVE_EXPO_FREE (expo); 1.30 + MPFR_SET_NAN (asin); 1.31 + MPFR_RET_NAN; 1.32 + } 1.33 +@@ -80,13 +83,11 @@ 1.34 + inexact = -mpfr_const_pi (asin, MPFR_INVERT_RND(rnd_mode)); 1.35 + MPFR_CHANGE_SIGN (asin); 1.36 + } 1.37 +- mpfr_div_2ui (asin, asin, 1, rnd_mode); /* May underflow */ 1.38 +- return inexact; 1.39 ++ mpfr_div_2ui (asin, asin, 1, rnd_mode); 1.40 + } 1.41 + } 1.42 +- 1.43 +- MPFR_SAVE_EXPO_MARK (expo); 1.44 +- 1.45 ++ else 1.46 ++ { 1.47 + /* Compute exponent of 1 - ABS(x) */ 1.48 + mpfr_ui_sub (xp, 1, xp, MPFR_RNDD); 1.49 + MPFR_ASSERTD (MPFR_GET_EXP (xp) <= 0); 1.50 +@@ -115,6 +116,7 @@ 1.51 + inexact = mpfr_set (asin, xp, rnd_mode); 1.52 + 1.53 + mpfr_clear (xp); 1.54 ++ } 1.55 + 1.56 + MPFR_SAVE_EXPO_FREE (expo); 1.57 + return mpfr_check_range (asin, inexact, rnd_mode); 1.58 +diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h 1.59 +--- mpfr-3.0.1-a/mpfr.h 2011-04-04 10:19:18.000000000 +0000 1.60 ++++ mpfr-3.0.1-b/mpfr.h 2011-04-12 10:50:02.000000000 +0000 1.61 +@@ -27,7 +27,7 @@ 1.62 + #define MPFR_VERSION_MAJOR 3 1.63 + #define MPFR_VERSION_MINOR 0 1.64 + #define MPFR_VERSION_PATCHLEVEL 1 1.65 +-#define MPFR_VERSION_STRING "3.0.1" 1.66 ++#define MPFR_VERSION_STRING "3.0.1-p1" 1.67 + 1.68 + /* Macros dealing with MPFR VERSION */ 1.69 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 1.70 +diff -Naurd mpfr-3.0.1-a/tests/tasin.c mpfr-3.0.1-b/tests/tasin.c 1.71 +--- mpfr-3.0.1-a/tests/tasin.c 2011-04-04 10:19:17.000000000 +0000 1.72 ++++ mpfr-3.0.1-b/tests/tasin.c 2011-04-12 10:50:02.000000000 +0000 1.73 +@@ -219,6 +219,49 @@ 1.74 + mpfr_clear (y); 1.75 + } 1.76 + 1.77 ++static void 1.78 ++reduced_expo_range (void) 1.79 ++{ 1.80 ++ mpfr_exp_t emin, emax; 1.81 ++ mpfr_t x, y, ex_y; 1.82 ++ int inex, ex_inex; 1.83 ++ unsigned int flags, ex_flags; 1.84 ++ 1.85 ++ emin = mpfr_get_emin (); 1.86 ++ emax = mpfr_get_emax (); 1.87 ++ 1.88 ++ mpfr_inits2 (4, x, y, ex_y, (mpfr_ptr) 0); 1.89 ++ mpfr_set_str (x, "-0.1e1", 2, MPFR_RNDN); 1.90 ++ 1.91 ++ mpfr_set_emin (1); 1.92 ++ mpfr_set_emax (1); 1.93 ++ mpfr_clear_flags (); 1.94 ++ inex = mpfr_asin (y, x, MPFR_RNDA); 1.95 ++ flags = __gmpfr_flags; 1.96 ++ mpfr_set_emin (emin); 1.97 ++ mpfr_set_emax (emax); 1.98 ++ 1.99 ++ mpfr_set_str (ex_y, "-0.1101e1", 2, MPFR_RNDN); 1.100 ++ ex_inex = -1; 1.101 ++ ex_flags = MPFR_FLAGS_INEXACT; 1.102 ++ 1.103 ++ if (SIGN (inex) != ex_inex || flags != ex_flags || 1.104 ++ ! mpfr_equal_p (y, ex_y)) 1.105 ++ { 1.106 ++ printf ("Error in reduced_expo_range\non x = "); 1.107 ++ mpfr_dump (x); 1.108 ++ printf ("Expected y = "); 1.109 ++ mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN); 1.110 ++ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags); 1.111 ++ printf ("Got y = "); 1.112 ++ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); 1.113 ++ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags); 1.114 ++ exit (1); 1.115 ++ } 1.116 ++ 1.117 ++ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0); 1.118 ++} 1.119 ++ 1.120 + int 1.121 + main (void) 1.122 + { 1.123 +@@ -226,6 +269,7 @@ 1.124 + 1.125 + special (); 1.126 + special_overflow (); 1.127 ++ reduced_expo_range (); 1.128 + 1.129 + test_generic (2, 100, 15); 1.130 + 1.131 +diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c 1.132 +--- mpfr-3.0.1-a/version.c 2011-04-04 10:19:18.000000000 +0000 1.133 ++++ mpfr-3.0.1-b/version.c 2011-04-12 10:50:02.000000000 +0000 1.134 +@@ -25,5 +25,5 @@ 1.135 + const char * 1.136 + mpfr_get_version (void) 1.137 + { 1.138 +- return "3.0.1"; 1.139 ++ return "3.0.1-p1"; 1.140 + } 1.141 +diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES 1.142 +--- mpfr-3.0.1-a/PATCHES 2011-05-04 11:18:33.000000000 +0000 1.143 ++++ mpfr-3.0.1-b/PATCHES 2011-05-04 11:18:33.000000000 +0000 1.144 +@@ -0,0 +1 @@ 1.145 ++rec_sqrt-carry 1.146 +diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION 1.147 +--- mpfr-3.0.1-a/VERSION 2011-04-12 10:50:02.000000000 +0000 1.148 ++++ mpfr-3.0.1-b/VERSION 2011-05-04 11:18:33.000000000 +0000 1.149 +@@ -1 +1 @@ 1.150 +-3.0.1-p1 1.151 ++3.0.1-p2 1.152 +diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h 1.153 +--- mpfr-3.0.1-a/mpfr.h 2011-04-12 10:50:02.000000000 +0000 1.154 ++++ mpfr-3.0.1-b/mpfr.h 2011-05-04 11:18:33.000000000 +0000 1.155 +@@ -27,7 +27,7 @@ 1.156 + #define MPFR_VERSION_MAJOR 3 1.157 + #define MPFR_VERSION_MINOR 0 1.158 + #define MPFR_VERSION_PATCHLEVEL 1 1.159 +-#define MPFR_VERSION_STRING "3.0.1-p1" 1.160 ++#define MPFR_VERSION_STRING "3.0.1-p2" 1.161 + 1.162 + /* Macros dealing with MPFR VERSION */ 1.163 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 1.164 +diff -Naurd mpfr-3.0.1-a/rec_sqrt.c mpfr-3.0.1-b/rec_sqrt.c 1.165 +--- mpfr-3.0.1-a/rec_sqrt.c 2011-04-04 10:19:18.000000000 +0000 1.166 ++++ mpfr-3.0.1-b/rec_sqrt.c 2011-05-04 11:18:33.000000000 +0000 1.167 +@@ -375,20 +375,37 @@ 1.168 + MPFR_ASSERTD(un == ln + 1 || un == ln + 2); 1.169 + /* the high un-ln limbs of u will overlap the low part of {x+ln,xn}, 1.170 + we need to add or subtract the overlapping part {u + ln, un - ln} */ 1.171 ++ /* Warning! th may be 0, in which case the mpn_add_1 and mpn_sub_1 1.172 ++ below (with size = th) mustn't be used. In such a case, the limb 1.173 ++ (carry) will be 0, so that this is semantically a no-op, but if 1.174 ++ mpn_add_1 and mpn_sub_1 are used, GMP (currently) still does a 1.175 ++ non-atomic read/write in a place that is not always allocated, 1.176 ++ with the possible consequences: a crash if the corresponding 1.177 ++ address is not mapped, or (rather unlikely) memory corruption 1.178 ++ if another process/thread writes at the same place; things may 1.179 ++ be worse with future GMP versions. Hence the tests carry != 0. */ 1.180 + if (neg == 0) 1.181 + { 1.182 + if (ln > 0) 1.183 + MPN_COPY (x, u, ln); 1.184 + cy = mpn_add (x + ln, x + ln, xn, u + ln, un - ln); 1.185 + /* add cu at x+un */ 1.186 +- cy += mpn_add_1 (x + un, x + un, th, cu); 1.187 ++ if (cu != 0) 1.188 ++ { 1.189 ++ MPFR_ASSERTD (th != 0); 1.190 ++ cy += mpn_add_1 (x + un, x + un, th, cu); 1.191 ++ } 1.192 + } 1.193 + else /* negative case */ 1.194 + { 1.195 + /* subtract {u+ln, un-ln} from {x+ln,un} */ 1.196 + cy = mpn_sub (x + ln, x + ln, xn, u + ln, un - ln); 1.197 + /* carry cy is at x+un, like cu */ 1.198 +- cy = mpn_sub_1 (x + un, x + un, th, cy + cu); /* n - un = th */ 1.199 ++ if (cy + cu != 0) 1.200 ++ { 1.201 ++ MPFR_ASSERTD (th != 0); 1.202 ++ cy = mpn_sub_1 (x + un, x + un, th, cy + cu); /* n - un = th */ 1.203 ++ } 1.204 + /* cy cannot be zero, since the most significant bit of Xh is 1, 1.205 + and the correction is bounded by 2^{-h+3} */ 1.206 + MPFR_ASSERTD(cy == 0); 1.207 +diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c 1.208 +--- mpfr-3.0.1-a/version.c 2011-04-12 10:50:02.000000000 +0000 1.209 ++++ mpfr-3.0.1-b/version.c 2011-05-04 11:18:33.000000000 +0000 1.210 +@@ -25,5 +25,5 @@ 1.211 + const char * 1.212 + mpfr_get_version (void) 1.213 + { 1.214 +- return "3.0.1-p1"; 1.215 ++ return "3.0.1-p2"; 1.216 + } 1.217 +diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES 1.218 +--- mpfr-3.0.1-a/PATCHES 2011-05-05 00:00:35.000000000 +0000 1.219 ++++ mpfr-3.0.1-b/PATCHES 2011-05-05 00:00:35.000000000 +0000 1.220 +@@ -0,0 +1 @@ 1.221 ++atan-expo-range 1.222 +diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION 1.223 +--- mpfr-3.0.1-a/VERSION 2011-05-04 11:18:33.000000000 +0000 1.224 ++++ mpfr-3.0.1-b/VERSION 2011-05-05 00:00:35.000000000 +0000 1.225 +@@ -1 +1 @@ 1.226 +-3.0.1-p2 1.227 ++3.0.1-p3 1.228 +diff -Naurd mpfr-3.0.1-a/atan.c mpfr-3.0.1-b/atan.c 1.229 +--- mpfr-3.0.1-a/atan.c 2011-04-04 10:19:18.000000000 +0000 1.230 ++++ mpfr-3.0.1-b/atan.c 2011-05-05 00:00:35.000000000 +0000 1.231 +@@ -431,5 +431,5 @@ 1.232 + MPFR_GROUP_CLEAR (group); 1.233 + 1.234 + MPFR_SAVE_EXPO_FREE (expo); 1.235 +- return mpfr_check_range (arctgt, inexact, rnd_mode); 1.236 ++ return mpfr_check_range (atan, inexact, rnd_mode); 1.237 + } 1.238 +diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h 1.239 +--- mpfr-3.0.1-a/mpfr.h 2011-05-04 11:18:33.000000000 +0000 1.240 ++++ mpfr-3.0.1-b/mpfr.h 2011-05-05 00:00:35.000000000 +0000 1.241 +@@ -27,7 +27,7 @@ 1.242 + #define MPFR_VERSION_MAJOR 3 1.243 + #define MPFR_VERSION_MINOR 0 1.244 + #define MPFR_VERSION_PATCHLEVEL 1 1.245 +-#define MPFR_VERSION_STRING "3.0.1-p2" 1.246 ++#define MPFR_VERSION_STRING "3.0.1-p3" 1.247 + 1.248 + /* Macros dealing with MPFR VERSION */ 1.249 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 1.250 +diff -Naurd mpfr-3.0.1-a/tests/tatan.c mpfr-3.0.1-b/tests/tatan.c 1.251 +--- mpfr-3.0.1-a/tests/tatan.c 2011-04-04 10:19:17.000000000 +0000 1.252 ++++ mpfr-3.0.1-b/tests/tatan.c 2011-05-05 00:00:35.000000000 +0000 1.253 +@@ -535,6 +535,52 @@ 1.254 + mpfr_clears (a, x, y, (mpfr_ptr) 0); 1.255 + } 1.256 + 1.257 ++/* http://websympa.loria.fr/wwsympa/arc/mpfr/2011-05/msg00008.html 1.258 ++ * Incorrect flags (in debug mode on a 32-bit machine, assertion failure). 1.259 ++ */ 1.260 ++static void 1.261 ++reduced_expo_range (void) 1.262 ++{ 1.263 ++ mpfr_exp_t emin, emax; 1.264 ++ mpfr_t x, y, ex_y; 1.265 ++ int inex, ex_inex; 1.266 ++ unsigned int flags, ex_flags; 1.267 ++ 1.268 ++ emin = mpfr_get_emin (); 1.269 ++ emax = mpfr_get_emax (); 1.270 ++ 1.271 ++ mpfr_inits2 (12, x, y, ex_y, (mpfr_ptr) 0); 1.272 ++ mpfr_set_str (x, "0.1e-5", 2, MPFR_RNDN); 1.273 ++ 1.274 ++ mpfr_set_emin (-5); 1.275 ++ mpfr_set_emax (-5); 1.276 ++ mpfr_clear_flags (); 1.277 ++ inex = mpfr_atan (y, x, MPFR_RNDN); 1.278 ++ flags = __gmpfr_flags; 1.279 ++ mpfr_set_emin (emin); 1.280 ++ mpfr_set_emax (emax); 1.281 ++ 1.282 ++ mpfr_set_str (ex_y, "0.1e-5", 2, MPFR_RNDN); 1.283 ++ ex_inex = 1; 1.284 ++ ex_flags = MPFR_FLAGS_INEXACT; 1.285 ++ 1.286 ++ if (SIGN (inex) != ex_inex || flags != ex_flags || 1.287 ++ ! mpfr_equal_p (y, ex_y)) 1.288 ++ { 1.289 ++ printf ("Error in reduced_expo_range\non x = "); 1.290 ++ mpfr_dump (x); 1.291 ++ printf ("Expected y = "); 1.292 ++ mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN); 1.293 ++ printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags); 1.294 ++ printf ("Got y = "); 1.295 ++ mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); 1.296 ++ printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags); 1.297 ++ exit (1); 1.298 ++ } 1.299 ++ 1.300 ++ mpfr_clears (x, y, ex_y, (mpfr_ptr) 0); 1.301 ++} 1.302 ++ 1.303 + int 1.304 + main (int argc, char *argv[]) 1.305 + { 1.306 +@@ -546,6 +592,7 @@ 1.307 + smallvals_atan2 (); 1.308 + atan2_bug_20071003 (); 1.309 + atan2_different_prec (); 1.310 ++ reduced_expo_range (); 1.311 + 1.312 + test_generic_atan (2, 200, 17); 1.313 + test_generic_atan2 (2, 200, 17); 1.314 +diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c 1.315 +--- mpfr-3.0.1-a/version.c 2011-05-04 11:18:33.000000000 +0000 1.316 ++++ mpfr-3.0.1-b/version.c 2011-05-05 00:00:35.000000000 +0000 1.317 +@@ -25,5 +25,5 @@ 1.318 + const char * 1.319 + mpfr_get_version (void) 1.320 + { 1.321 +- return "3.0.1-p2"; 1.322 ++ return "3.0.1-p3"; 1.323 + } 1.324 +diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES 1.325 +--- mpfr-3.0.1-a/PATCHES 2011-05-09 14:48:24.000000000 +0000 1.326 ++++ mpfr-3.0.1-b/PATCHES 2011-05-09 14:48:24.000000000 +0000 1.327 +@@ -0,0 +1 @@ 1.328 ++texp-zero 1.329 +diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION 1.330 +--- mpfr-3.0.1-a/VERSION 2011-05-05 00:00:35.000000000 +0000 1.331 ++++ mpfr-3.0.1-b/VERSION 2011-05-09 14:48:24.000000000 +0000 1.332 +@@ -1 +1 @@ 1.333 +-3.0.1-p3 1.334 ++3.0.1-p4 1.335 +diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h 1.336 +--- mpfr-3.0.1-a/mpfr.h 2011-05-05 00:00:35.000000000 +0000 1.337 ++++ mpfr-3.0.1-b/mpfr.h 2011-05-09 14:48:24.000000000 +0000 1.338 +@@ -27,7 +27,7 @@ 1.339 + #define MPFR_VERSION_MAJOR 3 1.340 + #define MPFR_VERSION_MINOR 0 1.341 + #define MPFR_VERSION_PATCHLEVEL 1 1.342 +-#define MPFR_VERSION_STRING "3.0.1-p3" 1.343 ++#define MPFR_VERSION_STRING "3.0.1-p4" 1.344 + 1.345 + /* Macros dealing with MPFR VERSION */ 1.346 + #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) 1.347 +diff -Naurd mpfr-3.0.1-a/tests/texp.c mpfr-3.0.1-b/tests/texp.c 1.348 +--- mpfr-3.0.1-a/tests/texp.c 2011-04-04 10:19:17.000000000 +0000 1.349 ++++ mpfr-3.0.1-b/tests/texp.c 2011-05-09 14:48:24.000000000 +0000 1.350 +@@ -170,7 +170,9 @@ 1.351 + mpfr_set_prec (x, prec); 1.352 + mpfr_set_prec (y, prec); 1.353 + mpfr_set_prec (z, prec); 1.354 +- mpfr_urandomb (x, RANDS); 1.355 ++ do 1.356 ++ mpfr_urandomb (x, RANDS); 1.357 ++ while (MPFR_IS_ZERO (x)); /* 0 is handled by mpfr_exp only */ 1.358 + rnd = RND_RAND (); 1.359 + mpfr_exp_2 (y, x, rnd); 1.360 + mpfr_exp_3 (z, x, rnd); 1.361 +diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c 1.362 +--- mpfr-3.0.1-a/version.c 2011-05-05 00:00:35.000000000 +0000 1.363 ++++ mpfr-3.0.1-b/version.c 2011-05-09 14:48:24.000000000 +0000 1.364 +@@ -25,5 +25,5 @@ 1.365 + const char * 1.366 + mpfr_get_version (void) 1.367 + { 1.368 +- return "3.0.1-p3"; 1.369 ++ return "3.0.1-p4"; 1.370 + }