wok-6.x view 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 source
1 diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES
2 --- mpfr-3.0.1-a/PATCHES 2011-04-12 10:50:02.000000000 +0000
3 +++ mpfr-3.0.1-b/PATCHES 2011-04-12 10:50:02.000000000 +0000
4 @@ -0,0 +1 @@
5 +asin_exprange
6 diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION
7 --- mpfr-3.0.1-a/VERSION 2011-04-04 10:19:18.000000000 +0000
8 +++ mpfr-3.0.1-b/VERSION 2011-04-12 10:50:02.000000000 +0000
9 @@ -1 +1 @@
10 -3.0.1
11 +3.0.1-p1
12 diff -Naurd mpfr-3.0.1-a/asin.c mpfr-3.0.1-b/asin.c
13 --- mpfr-3.0.1-a/asin.c 2011-04-04 10:19:18.000000000 +0000
14 +++ mpfr-3.0.1-b/asin.c 2011-04-12 10:50:02.000000000 +0000
15 @@ -63,11 +63,14 @@
17 compared = mpfr_cmp_ui (xp, 1);
19 + MPFR_SAVE_EXPO_MARK (expo);
20 +
21 if (MPFR_UNLIKELY (compared >= 0))
22 {
23 mpfr_clear (xp);
24 if (compared > 0) /* asin(x) = NaN for |x| > 1 */
25 {
26 + MPFR_SAVE_EXPO_FREE (expo);
27 MPFR_SET_NAN (asin);
28 MPFR_RET_NAN;
29 }
30 @@ -80,13 +83,11 @@
31 inexact = -mpfr_const_pi (asin, MPFR_INVERT_RND(rnd_mode));
32 MPFR_CHANGE_SIGN (asin);
33 }
34 - mpfr_div_2ui (asin, asin, 1, rnd_mode); /* May underflow */
35 - return inexact;
36 + mpfr_div_2ui (asin, asin, 1, rnd_mode);
37 }
38 }
39 -
40 - MPFR_SAVE_EXPO_MARK (expo);
41 -
42 + else
43 + {
44 /* Compute exponent of 1 - ABS(x) */
45 mpfr_ui_sub (xp, 1, xp, MPFR_RNDD);
46 MPFR_ASSERTD (MPFR_GET_EXP (xp) <= 0);
47 @@ -115,6 +116,7 @@
48 inexact = mpfr_set (asin, xp, rnd_mode);
50 mpfr_clear (xp);
51 + }
53 MPFR_SAVE_EXPO_FREE (expo);
54 return mpfr_check_range (asin, inexact, rnd_mode);
55 diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h
56 --- mpfr-3.0.1-a/mpfr.h 2011-04-04 10:19:18.000000000 +0000
57 +++ mpfr-3.0.1-b/mpfr.h 2011-04-12 10:50:02.000000000 +0000
58 @@ -27,7 +27,7 @@
59 #define MPFR_VERSION_MAJOR 3
60 #define MPFR_VERSION_MINOR 0
61 #define MPFR_VERSION_PATCHLEVEL 1
62 -#define MPFR_VERSION_STRING "3.0.1"
63 +#define MPFR_VERSION_STRING "3.0.1-p1"
65 /* Macros dealing with MPFR VERSION */
66 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
67 diff -Naurd mpfr-3.0.1-a/tests/tasin.c mpfr-3.0.1-b/tests/tasin.c
68 --- mpfr-3.0.1-a/tests/tasin.c 2011-04-04 10:19:17.000000000 +0000
69 +++ mpfr-3.0.1-b/tests/tasin.c 2011-04-12 10:50:02.000000000 +0000
70 @@ -219,6 +219,49 @@
71 mpfr_clear (y);
72 }
74 +static void
75 +reduced_expo_range (void)
76 +{
77 + mpfr_exp_t emin, emax;
78 + mpfr_t x, y, ex_y;
79 + int inex, ex_inex;
80 + unsigned int flags, ex_flags;
81 +
82 + emin = mpfr_get_emin ();
83 + emax = mpfr_get_emax ();
84 +
85 + mpfr_inits2 (4, x, y, ex_y, (mpfr_ptr) 0);
86 + mpfr_set_str (x, "-0.1e1", 2, MPFR_RNDN);
87 +
88 + mpfr_set_emin (1);
89 + mpfr_set_emax (1);
90 + mpfr_clear_flags ();
91 + inex = mpfr_asin (y, x, MPFR_RNDA);
92 + flags = __gmpfr_flags;
93 + mpfr_set_emin (emin);
94 + mpfr_set_emax (emax);
95 +
96 + mpfr_set_str (ex_y, "-0.1101e1", 2, MPFR_RNDN);
97 + ex_inex = -1;
98 + ex_flags = MPFR_FLAGS_INEXACT;
99 +
100 + if (SIGN (inex) != ex_inex || flags != ex_flags ||
101 + ! mpfr_equal_p (y, ex_y))
102 + {
103 + printf ("Error in reduced_expo_range\non x = ");
104 + mpfr_dump (x);
105 + printf ("Expected y = ");
106 + mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
107 + printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
108 + printf ("Got y = ");
109 + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
110 + printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
111 + exit (1);
112 + }
113 +
114 + mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
115 +}
116 +
117 int
118 main (void)
119 {
120 @@ -226,6 +269,7 @@
122 special ();
123 special_overflow ();
124 + reduced_expo_range ();
126 test_generic (2, 100, 15);
128 diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c
129 --- mpfr-3.0.1-a/version.c 2011-04-04 10:19:18.000000000 +0000
130 +++ mpfr-3.0.1-b/version.c 2011-04-12 10:50:02.000000000 +0000
131 @@ -25,5 +25,5 @@
132 const char *
133 mpfr_get_version (void)
134 {
135 - return "3.0.1";
136 + return "3.0.1-p1";
137 }
138 diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES
139 --- mpfr-3.0.1-a/PATCHES 2011-05-04 11:18:33.000000000 +0000
140 +++ mpfr-3.0.1-b/PATCHES 2011-05-04 11:18:33.000000000 +0000
141 @@ -0,0 +1 @@
142 +rec_sqrt-carry
143 diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION
144 --- mpfr-3.0.1-a/VERSION 2011-04-12 10:50:02.000000000 +0000
145 +++ mpfr-3.0.1-b/VERSION 2011-05-04 11:18:33.000000000 +0000
146 @@ -1 +1 @@
147 -3.0.1-p1
148 +3.0.1-p2
149 diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h
150 --- mpfr-3.0.1-a/mpfr.h 2011-04-12 10:50:02.000000000 +0000
151 +++ mpfr-3.0.1-b/mpfr.h 2011-05-04 11:18:33.000000000 +0000
152 @@ -27,7 +27,7 @@
153 #define MPFR_VERSION_MAJOR 3
154 #define MPFR_VERSION_MINOR 0
155 #define MPFR_VERSION_PATCHLEVEL 1
156 -#define MPFR_VERSION_STRING "3.0.1-p1"
157 +#define MPFR_VERSION_STRING "3.0.1-p2"
159 /* Macros dealing with MPFR VERSION */
160 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
161 diff -Naurd mpfr-3.0.1-a/rec_sqrt.c mpfr-3.0.1-b/rec_sqrt.c
162 --- mpfr-3.0.1-a/rec_sqrt.c 2011-04-04 10:19:18.000000000 +0000
163 +++ mpfr-3.0.1-b/rec_sqrt.c 2011-05-04 11:18:33.000000000 +0000
164 @@ -375,20 +375,37 @@
165 MPFR_ASSERTD(un == ln + 1 || un == ln + 2);
166 /* the high un-ln limbs of u will overlap the low part of {x+ln,xn},
167 we need to add or subtract the overlapping part {u + ln, un - ln} */
168 + /* Warning! th may be 0, in which case the mpn_add_1 and mpn_sub_1
169 + below (with size = th) mustn't be used. In such a case, the limb
170 + (carry) will be 0, so that this is semantically a no-op, but if
171 + mpn_add_1 and mpn_sub_1 are used, GMP (currently) still does a
172 + non-atomic read/write in a place that is not always allocated,
173 + with the possible consequences: a crash if the corresponding
174 + address is not mapped, or (rather unlikely) memory corruption
175 + if another process/thread writes at the same place; things may
176 + be worse with future GMP versions. Hence the tests carry != 0. */
177 if (neg == 0)
178 {
179 if (ln > 0)
180 MPN_COPY (x, u, ln);
181 cy = mpn_add (x + ln, x + ln, xn, u + ln, un - ln);
182 /* add cu at x+un */
183 - cy += mpn_add_1 (x + un, x + un, th, cu);
184 + if (cu != 0)
185 + {
186 + MPFR_ASSERTD (th != 0);
187 + cy += mpn_add_1 (x + un, x + un, th, cu);
188 + }
189 }
190 else /* negative case */
191 {
192 /* subtract {u+ln, un-ln} from {x+ln,un} */
193 cy = mpn_sub (x + ln, x + ln, xn, u + ln, un - ln);
194 /* carry cy is at x+un, like cu */
195 - cy = mpn_sub_1 (x + un, x + un, th, cy + cu); /* n - un = th */
196 + if (cy + cu != 0)
197 + {
198 + MPFR_ASSERTD (th != 0);
199 + cy = mpn_sub_1 (x + un, x + un, th, cy + cu); /* n - un = th */
200 + }
201 /* cy cannot be zero, since the most significant bit of Xh is 1,
202 and the correction is bounded by 2^{-h+3} */
203 MPFR_ASSERTD(cy == 0);
204 diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c
205 --- mpfr-3.0.1-a/version.c 2011-04-12 10:50:02.000000000 +0000
206 +++ mpfr-3.0.1-b/version.c 2011-05-04 11:18:33.000000000 +0000
207 @@ -25,5 +25,5 @@
208 const char *
209 mpfr_get_version (void)
210 {
211 - return "3.0.1-p1";
212 + return "3.0.1-p2";
213 }
214 diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES
215 --- mpfr-3.0.1-a/PATCHES 2011-05-05 00:00:35.000000000 +0000
216 +++ mpfr-3.0.1-b/PATCHES 2011-05-05 00:00:35.000000000 +0000
217 @@ -0,0 +1 @@
218 +atan-expo-range
219 diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION
220 --- mpfr-3.0.1-a/VERSION 2011-05-04 11:18:33.000000000 +0000
221 +++ mpfr-3.0.1-b/VERSION 2011-05-05 00:00:35.000000000 +0000
222 @@ -1 +1 @@
223 -3.0.1-p2
224 +3.0.1-p3
225 diff -Naurd mpfr-3.0.1-a/atan.c mpfr-3.0.1-b/atan.c
226 --- mpfr-3.0.1-a/atan.c 2011-04-04 10:19:18.000000000 +0000
227 +++ mpfr-3.0.1-b/atan.c 2011-05-05 00:00:35.000000000 +0000
228 @@ -431,5 +431,5 @@
229 MPFR_GROUP_CLEAR (group);
231 MPFR_SAVE_EXPO_FREE (expo);
232 - return mpfr_check_range (arctgt, inexact, rnd_mode);
233 + return mpfr_check_range (atan, inexact, rnd_mode);
234 }
235 diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h
236 --- mpfr-3.0.1-a/mpfr.h 2011-05-04 11:18:33.000000000 +0000
237 +++ mpfr-3.0.1-b/mpfr.h 2011-05-05 00:00:35.000000000 +0000
238 @@ -27,7 +27,7 @@
239 #define MPFR_VERSION_MAJOR 3
240 #define MPFR_VERSION_MINOR 0
241 #define MPFR_VERSION_PATCHLEVEL 1
242 -#define MPFR_VERSION_STRING "3.0.1-p2"
243 +#define MPFR_VERSION_STRING "3.0.1-p3"
245 /* Macros dealing with MPFR VERSION */
246 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
247 diff -Naurd mpfr-3.0.1-a/tests/tatan.c mpfr-3.0.1-b/tests/tatan.c
248 --- mpfr-3.0.1-a/tests/tatan.c 2011-04-04 10:19:17.000000000 +0000
249 +++ mpfr-3.0.1-b/tests/tatan.c 2011-05-05 00:00:35.000000000 +0000
250 @@ -535,6 +535,52 @@
251 mpfr_clears (a, x, y, (mpfr_ptr) 0);
252 }
254 +/* http://websympa.loria.fr/wwsympa/arc/mpfr/2011-05/msg00008.html
255 + * Incorrect flags (in debug mode on a 32-bit machine, assertion failure).
256 + */
257 +static void
258 +reduced_expo_range (void)
259 +{
260 + mpfr_exp_t emin, emax;
261 + mpfr_t x, y, ex_y;
262 + int inex, ex_inex;
263 + unsigned int flags, ex_flags;
264 +
265 + emin = mpfr_get_emin ();
266 + emax = mpfr_get_emax ();
267 +
268 + mpfr_inits2 (12, x, y, ex_y, (mpfr_ptr) 0);
269 + mpfr_set_str (x, "0.1e-5", 2, MPFR_RNDN);
270 +
271 + mpfr_set_emin (-5);
272 + mpfr_set_emax (-5);
273 + mpfr_clear_flags ();
274 + inex = mpfr_atan (y, x, MPFR_RNDN);
275 + flags = __gmpfr_flags;
276 + mpfr_set_emin (emin);
277 + mpfr_set_emax (emax);
278 +
279 + mpfr_set_str (ex_y, "0.1e-5", 2, MPFR_RNDN);
280 + ex_inex = 1;
281 + ex_flags = MPFR_FLAGS_INEXACT;
282 +
283 + if (SIGN (inex) != ex_inex || flags != ex_flags ||
284 + ! mpfr_equal_p (y, ex_y))
285 + {
286 + printf ("Error in reduced_expo_range\non x = ");
287 + mpfr_dump (x);
288 + printf ("Expected y = ");
289 + mpfr_out_str (stdout, 2, 0, ex_y, MPFR_RNDN);
290 + printf ("\n inex = %d, flags = %u\n", ex_inex, ex_flags);
291 + printf ("Got y = ");
292 + mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN);
293 + printf ("\n inex = %d, flags = %u\n", SIGN (inex), flags);
294 + exit (1);
295 + }
296 +
297 + mpfr_clears (x, y, ex_y, (mpfr_ptr) 0);
298 +}
299 +
300 int
301 main (int argc, char *argv[])
302 {
303 @@ -546,6 +592,7 @@
304 smallvals_atan2 ();
305 atan2_bug_20071003 ();
306 atan2_different_prec ();
307 + reduced_expo_range ();
309 test_generic_atan (2, 200, 17);
310 test_generic_atan2 (2, 200, 17);
311 diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c
312 --- mpfr-3.0.1-a/version.c 2011-05-04 11:18:33.000000000 +0000
313 +++ mpfr-3.0.1-b/version.c 2011-05-05 00:00:35.000000000 +0000
314 @@ -25,5 +25,5 @@
315 const char *
316 mpfr_get_version (void)
317 {
318 - return "3.0.1-p2";
319 + return "3.0.1-p3";
320 }
321 diff -Naurd mpfr-3.0.1-a/PATCHES mpfr-3.0.1-b/PATCHES
322 --- mpfr-3.0.1-a/PATCHES 2011-05-09 14:48:24.000000000 +0000
323 +++ mpfr-3.0.1-b/PATCHES 2011-05-09 14:48:24.000000000 +0000
324 @@ -0,0 +1 @@
325 +texp-zero
326 diff -Naurd mpfr-3.0.1-a/VERSION mpfr-3.0.1-b/VERSION
327 --- mpfr-3.0.1-a/VERSION 2011-05-05 00:00:35.000000000 +0000
328 +++ mpfr-3.0.1-b/VERSION 2011-05-09 14:48:24.000000000 +0000
329 @@ -1 +1 @@
330 -3.0.1-p3
331 +3.0.1-p4
332 diff -Naurd mpfr-3.0.1-a/mpfr.h mpfr-3.0.1-b/mpfr.h
333 --- mpfr-3.0.1-a/mpfr.h 2011-05-05 00:00:35.000000000 +0000
334 +++ mpfr-3.0.1-b/mpfr.h 2011-05-09 14:48:24.000000000 +0000
335 @@ -27,7 +27,7 @@
336 #define MPFR_VERSION_MAJOR 3
337 #define MPFR_VERSION_MINOR 0
338 #define MPFR_VERSION_PATCHLEVEL 1
339 -#define MPFR_VERSION_STRING "3.0.1-p3"
340 +#define MPFR_VERSION_STRING "3.0.1-p4"
342 /* Macros dealing with MPFR VERSION */
343 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
344 diff -Naurd mpfr-3.0.1-a/tests/texp.c mpfr-3.0.1-b/tests/texp.c
345 --- mpfr-3.0.1-a/tests/texp.c 2011-04-04 10:19:17.000000000 +0000
346 +++ mpfr-3.0.1-b/tests/texp.c 2011-05-09 14:48:24.000000000 +0000
347 @@ -170,7 +170,9 @@
348 mpfr_set_prec (x, prec);
349 mpfr_set_prec (y, prec);
350 mpfr_set_prec (z, prec);
351 - mpfr_urandomb (x, RANDS);
352 + do
353 + mpfr_urandomb (x, RANDS);
354 + while (MPFR_IS_ZERO (x)); /* 0 is handled by mpfr_exp only */
355 rnd = RND_RAND ();
356 mpfr_exp_2 (y, x, rnd);
357 mpfr_exp_3 (z, x, rnd);
358 diff -Naurd mpfr-3.0.1-a/version.c mpfr-3.0.1-b/version.c
359 --- mpfr-3.0.1-a/version.c 2011-05-05 00:00:35.000000000 +0000
360 +++ mpfr-3.0.1-b/version.c 2011-05-09 14:48:24.000000000 +0000
361 @@ -25,5 +25,5 @@
362 const char *
363 mpfr_get_version (void)
364 {
365 - return "3.0.1-p3";
366 + return "3.0.1-p4";
367 }