rev |
line source |
pankso@12265
|
1 Submitted By: Matt Burgess <matthew_at_linuxfromscratch_dot_org>
|
pankso@12265
|
2 Date: 2011-12-22
|
pankso@12265
|
3 Initial Package Version: 3.1.0
|
pankso@12265
|
4 Upstream Status: Already in upstream patch repo
|
pankso@12265
|
5 Origin: Upstream
|
pankso@12265
|
6 Description: This patch contains patches for several bugs in MPFR,
|
pankso@12265
|
7 the main one being a rounding related error with the
|
pankso@12265
|
8 mpfr_*printf functions.
|
pankso@12265
|
9
|
pankso@12265
|
10 diff -Naur mpfr-3.1.0.orig/PATCHES mpfr-3.1.0/PATCHES
|
pankso@12265
|
11 --- mpfr-3.1.0.orig/PATCHES 2011-10-03 08:17:15.000000000 +0000
|
pankso@12265
|
12 +++ mpfr-3.1.0/PATCHES 2011-12-22 11:08:42.188819413 +0000
|
pankso@12265
|
13 @@ -0,0 +1,4 @@
|
pankso@12265
|
14 +gmp41compat
|
pankso@12265
|
15 +vasprintf
|
pankso@12265
|
16 +lib-search-path
|
pankso@12265
|
17 +mpfr_unlikely
|
pankso@12265
|
18 diff -Naur mpfr-3.1.0.orig/VERSION mpfr-3.1.0/VERSION
|
pankso@12265
|
19 --- mpfr-3.1.0.orig/VERSION 2011-10-03 08:17:15.000000000 +0000
|
pankso@12265
|
20 +++ mpfr-3.1.0/VERSION 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
21 @@ -1 +1 @@
|
pankso@12265
|
22 -3.1.0
|
pankso@12265
|
23 +3.1.0-p4
|
pankso@12265
|
24 diff -Naur mpfr-3.1.0.orig/doc/mpfr.info mpfr-3.1.0/doc/mpfr.info
|
pankso@12265
|
25 --- mpfr-3.1.0.orig/doc/mpfr.info 2011-10-03 09:43:04.000000000 +0000
|
pankso@12265
|
26 +++ mpfr-3.1.0/doc/mpfr.info 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
27 @@ -2994,11 +2994,12 @@
|
pankso@12265
|
28
|
pankso@12265
|
29 * `mpfr_urandom' and `mpfr_urandomb' changed in MPFR 3.1. Their
|
pankso@12265
|
30 behavior no longer depends on the platform (assuming this is also
|
pankso@12265
|
31 - true for GMP's random generator). As a consequence, the returned
|
pankso@12265
|
32 - values can be different between MPFR 3.1 and previous MPFR
|
pankso@12265
|
33 - versions. Note: as the reproducibility of these functions was not
|
pankso@12265
|
34 - specified before MPFR 3.1, the MPFR 3.1 behavior is _not_ regarded
|
pankso@12265
|
35 - as backward incompatible with previous versions.
|
pankso@12265
|
36 + true for GMP's random generator, which is not the case between GMP
|
pankso@12265
|
37 + 4.1 and 4.2 if `gmp_randinit_default' is used). As a consequence,
|
pankso@12265
|
38 + the returned values can be different between MPFR 3.1 and previous
|
pankso@12265
|
39 + MPFR versions. Note: as the reproducibility of these functions
|
pankso@12265
|
40 + was not specified before MPFR 3.1, the MPFR 3.1 behavior is _not_
|
pankso@12265
|
41 + regarded as backward incompatible with previous versions.
|
pankso@12265
|
42
|
pankso@12265
|
43
|
pankso@12265
|
44
|
pankso@12265
|
45 @@ -4239,13 +4240,13 @@
|
pankso@12265
|
46 Node: Type and Macro Changes129308
|
pankso@12265
|
47 Node: Added Functions132029
|
pankso@12265
|
48 Node: Changed Functions134972
|
pankso@12265
|
49 -Node: Removed Functions139167
|
pankso@12265
|
50 -Node: Other Changes139579
|
pankso@12265
|
51 -Node: Contributors141108
|
pankso@12265
|
52 -Node: References143574
|
pankso@12265
|
53 -Node: GNU Free Documentation License145315
|
pankso@12265
|
54 -Node: Concept Index167758
|
pankso@12265
|
55 -Node: Function and Type Index173677
|
pankso@12265
|
56 +Node: Removed Functions139253
|
pankso@12265
|
57 +Node: Other Changes139665
|
pankso@12265
|
58 +Node: Contributors141194
|
pankso@12265
|
59 +Node: References143660
|
pankso@12265
|
60 +Node: GNU Free Documentation License145401
|
pankso@12265
|
61 +Node: Concept Index167844
|
pankso@12265
|
62 +Node: Function and Type Index173763
|
pankso@12265
|
63
|
pankso@12265
|
64 End Tag Table
|
pankso@12265
|
65
|
pankso@12265
|
66 diff -Naur mpfr-3.1.0.orig/doc/mpfr.texi mpfr-3.1.0/doc/mpfr.texi
|
pankso@12265
|
67 --- mpfr-3.1.0.orig/doc/mpfr.texi 2011-10-03 08:17:14.000000000 +0000
|
pankso@12265
|
68 +++ mpfr-3.1.0/doc/mpfr.texi 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
69 @@ -3466,8 +3466,9 @@
|
pankso@12265
|
70 a lack of specification.
|
pankso@12265
|
71
|
pankso@12265
|
72 @item @code{mpfr_urandom} and @code{mpfr_urandomb} changed in MPFR 3.1.
|
pankso@12265
|
73 -Their behavior no longer depends on the platform (assuming this is also
|
pankso@12265
|
74 -true for GMP's random generator). As a consequence, the returned values
|
pankso@12265
|
75 +Their behavior no longer depends on the platform (assuming this is also true
|
pankso@12265
|
76 +for GMP's random generator, which is not the case between GMP 4.1 and 4.2 if
|
pankso@12265
|
77 +@code{gmp_randinit_default} is used). As a consequence, the returned values
|
pankso@12265
|
78 can be different between MPFR 3.1 and previous MPFR versions.
|
pankso@12265
|
79 Note: as the reproducibility of these functions was not specified
|
pankso@12265
|
80 before MPFR 3.1, the MPFR 3.1 behavior is @emph{not} regarded as
|
pankso@12265
|
81 diff -Naur mpfr-3.1.0.orig/src/mpfr-impl.h mpfr-3.1.0/src/mpfr-impl.h
|
pankso@12265
|
82 --- mpfr-3.1.0.orig/src/mpfr-impl.h 2011-10-03 08:17:09.000000000 +0000
|
pankso@12265
|
83 +++ mpfr-3.1.0/src/mpfr-impl.h 2011-10-05 21:39:57.000000000 +0000
|
pankso@12265
|
84 @@ -988,10 +988,11 @@
|
pankso@12265
|
85 ******************************************************/
|
pankso@12265
|
86
|
pankso@12265
|
87 /* Theses macros help the compiler to determine if a test is
|
pankso@12265
|
88 - * likely or unlikely. */
|
pankso@12265
|
89 + likely or unlikely. The !! is necessary in case x is larger
|
pankso@12265
|
90 + than a long. */
|
pankso@12265
|
91 #if __MPFR_GNUC(3,0) || __MPFR_ICC(8,1,0)
|
pankso@12265
|
92 # define MPFR_LIKELY(x) (__builtin_expect(!!(x),1))
|
pankso@12265
|
93 -# define MPFR_UNLIKELY(x) (__builtin_expect((x),0))
|
pankso@12265
|
94 +# define MPFR_UNLIKELY(x) (__builtin_expect(!!(x),0))
|
pankso@12265
|
95 #else
|
pankso@12265
|
96 # define MPFR_LIKELY(x) (x)
|
pankso@12265
|
97 # define MPFR_UNLIKELY(x) (x)
|
pankso@12265
|
98 diff -Naur mpfr-3.1.0.orig/src/mpfr.h mpfr-3.1.0/src/mpfr.h
|
pankso@12265
|
99 --- mpfr-3.1.0.orig/src/mpfr.h 2011-10-03 08:17:09.000000000 +0000
|
pankso@12265
|
100 +++ mpfr-3.1.0/src/mpfr.h 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
101 @@ -27,7 +27,7 @@
|
pankso@12265
|
102 #define MPFR_VERSION_MAJOR 3
|
pankso@12265
|
103 #define MPFR_VERSION_MINOR 1
|
pankso@12265
|
104 #define MPFR_VERSION_PATCHLEVEL 0
|
pankso@12265
|
105 -#define MPFR_VERSION_STRING "3.1.0"
|
pankso@12265
|
106 +#define MPFR_VERSION_STRING "3.1.0-p4"
|
pankso@12265
|
107
|
pankso@12265
|
108 /* Macros dealing with MPFR VERSION */
|
pankso@12265
|
109 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
pankso@12265
|
110 diff -Naur mpfr-3.1.0.orig/src/vasprintf.c mpfr-3.1.0/src/vasprintf.c
|
pankso@12265
|
111 --- mpfr-3.1.0.orig/src/vasprintf.c 2011-10-03 08:17:09.000000000 +0000
|
pankso@12265
|
112 +++ mpfr-3.1.0/src/vasprintf.c 2011-11-03 15:15:11.000000000 +0000
|
pankso@12265
|
113 @@ -1178,7 +1178,7 @@
|
pankso@12265
|
114 mpfr_exp_t exp;
|
pankso@12265
|
115 char * str;
|
pankso@12265
|
116 const int spec_g = (spec.spec == 'g' || spec.spec == 'G');
|
pankso@12265
|
117 - const int keep_trailing_zeros = spec_g && spec.alt;
|
pankso@12265
|
118 + const int keep_trailing_zeros = !spec_g || spec.alt;
|
pankso@12265
|
119
|
pankso@12265
|
120 /* WARNING: an empty precision field is forbidden (it means precision = 6
|
pankso@12265
|
121 and it should have been changed to 6 before the function call) */
|
pankso@12265
|
122 @@ -1356,7 +1356,7 @@
|
pankso@12265
|
123 else
|
pankso@12265
|
124 /* 1 <= |p| */
|
pankso@12265
|
125 {
|
pankso@12265
|
126 - size_t nsd; /* Number of significant digits */
|
pankso@12265
|
127 + size_t str_len;
|
pankso@12265
|
128
|
pankso@12265
|
129 /* Determine the position of the most significant decimal digit. */
|
pankso@12265
|
130 exp = floor_log10 (p);
|
pankso@12265
|
131 @@ -1365,12 +1365,10 @@
|
pankso@12265
|
132 /* P is too large to print all its integral part digits */
|
pankso@12265
|
133 return -1;
|
pankso@12265
|
134
|
pankso@12265
|
135 - np->ip_size = exp + 1;
|
pankso@12265
|
136 -
|
pankso@12265
|
137 - nsd = spec.prec + np->ip_size;
|
pankso@12265
|
138 if (dec_info == NULL)
|
pankso@12265
|
139 - {
|
pankso@12265
|
140 - str = mpfr_get_str (NULL, &exp, 10, nsd, p, spec.rnd_mode);
|
pankso@12265
|
141 + { /* this case occurs with mpfr_printf ("%.0RUf", x) with x=9.5 */
|
pankso@12265
|
142 + str =
|
pankso@12265
|
143 + mpfr_get_str (NULL, &exp, 10, spec.prec+exp+1, p, spec.rnd_mode);
|
pankso@12265
|
144 register_string (np->sl, str);
|
pankso@12265
|
145 }
|
pankso@12265
|
146 else
|
pankso@12265
|
147 @@ -1379,81 +1377,60 @@
|
pankso@12265
|
148 str = dec_info->str;
|
pankso@12265
|
149 }
|
pankso@12265
|
150 np->ip_ptr = MPFR_IS_NEG (p) ? ++str : str; /* skip sign */
|
pankso@12265
|
151 + str_len = strlen (str);
|
pankso@12265
|
152 +
|
pankso@12265
|
153 + /* integral part */
|
pankso@12265
|
154 + if (exp > str_len)
|
pankso@12265
|
155 + /* mpfr_get_str gives no trailing zero when p is rounded up to the next
|
pankso@12265
|
156 + power of 10 (p integer, so no fractional part) */
|
pankso@12265
|
157 + {
|
pankso@12265
|
158 + np->ip_trailing_zeros = exp - str_len;
|
pankso@12265
|
159 + np->ip_size = str_len;
|
pankso@12265
|
160 + }
|
pankso@12265
|
161 + else
|
pankso@12265
|
162 + np->ip_size = exp;
|
pankso@12265
|
163
|
pankso@12265
|
164 if (spec.group)
|
pankso@12265
|
165 /* thousands separator in integral part */
|
pankso@12265
|
166 np->thousands_sep = MPFR_THOUSANDS_SEPARATOR;
|
pankso@12265
|
167
|
pankso@12265
|
168 - if (nsd == 0 || (spec_g && !spec.alt))
|
pankso@12265
|
169 - /* compute how much non-zero digits in integral and fractional
|
pankso@12265
|
170 - parts */
|
pankso@12265
|
171 + /* fractional part */
|
pankso@12265
|
172 + str += np->ip_size;
|
pankso@12265
|
173 + str_len -= np->ip_size;
|
pankso@12265
|
174 + if (!keep_trailing_zeros)
|
pankso@12265
|
175 + /* remove trailing zeros, if any */
|
pankso@12265
|
176 {
|
pankso@12265
|
177 - size_t str_len;
|
pankso@12265
|
178 - str_len = strlen (str); /* note: the sign has been skipped */
|
pankso@12265
|
179 -
|
pankso@12265
|
180 - if (exp > str_len)
|
pankso@12265
|
181 - /* mpfr_get_str doesn't give the trailing zeros when p is a
|
pankso@12265
|
182 - multiple of 10 (p integer, so no fractional part) */
|
pankso@12265
|
183 + char *ptr = str + str_len - 1; /* pointer to the last digit of
|
pankso@12265
|
184 + str */
|
pankso@12265
|
185 + while ((*ptr == '0') && (str_len != 0))
|
pankso@12265
|
186 {
|
pankso@12265
|
187 - np->ip_trailing_zeros = exp - str_len;
|
pankso@12265
|
188 - np->ip_size = str_len;
|
pankso@12265
|
189 - if (spec.alt)
|
pankso@12265
|
190 - np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
191 - }
|
pankso@12265
|
192 - else
|
pankso@12265
|
193 - /* str may contain some digits which are in fractional part */
|
pankso@12265
|
194 - {
|
pankso@12265
|
195 - char *ptr;
|
pankso@12265
|
196 -
|
pankso@12265
|
197 - ptr = str + str_len - 1; /* points to the end of str */
|
pankso@12265
|
198 - str_len -= np->ip_size; /* number of digits in fractional
|
pankso@12265
|
199 - part */
|
pankso@12265
|
200 -
|
pankso@12265
|
201 - if (!keep_trailing_zeros)
|
pankso@12265
|
202 - /* remove trailing zeros, if any */
|
pankso@12265
|
203 - {
|
pankso@12265
|
204 - while ((*ptr == '0') && (str_len != 0))
|
pankso@12265
|
205 - {
|
pankso@12265
|
206 - --ptr;
|
pankso@12265
|
207 - --str_len;
|
pankso@12265
|
208 - }
|
pankso@12265
|
209 - }
|
pankso@12265
|
210 -
|
pankso@12265
|
211 - if (str_len > INT_MAX)
|
pankso@12265
|
212 - /* too many digits in fractional part */
|
pankso@12265
|
213 - return -1;
|
pankso@12265
|
214 -
|
pankso@12265
|
215 - if (str_len != 0)
|
pankso@12265
|
216 - /* some digits in fractional part */
|
pankso@12265
|
217 - {
|
pankso@12265
|
218 - np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
219 - np->fp_ptr = str + np->ip_size;
|
pankso@12265
|
220 - np->fp_size = str_len;
|
pankso@12265
|
221 - }
|
pankso@12265
|
222 + --ptr;
|
pankso@12265
|
223 + --str_len;
|
pankso@12265
|
224 }
|
pankso@12265
|
225 }
|
pankso@12265
|
226 - else
|
pankso@12265
|
227 - /* spec.prec digits in fractional part */
|
pankso@12265
|
228 - {
|
pankso@12265
|
229 - if (np->ip_size == exp - 1)
|
pankso@12265
|
230 - /* the absolute value of the number has been rounded up to a power
|
pankso@12265
|
231 - of ten.
|
pankso@12265
|
232 - Insert an additional zero in integral part and put the rest of
|
pankso@12265
|
233 - them in fractional part. */
|
pankso@12265
|
234 - np->ip_trailing_zeros = 1;
|
pankso@12265
|
235
|
pankso@12265
|
236 - if (spec.prec != 0)
|
pankso@12265
|
237 - {
|
pankso@12265
|
238 - MPFR_ASSERTD (np->ip_size + np->ip_trailing_zeros == exp);
|
pankso@12265
|
239 - MPFR_ASSERTD (np->ip_size + spec.prec == nsd);
|
pankso@12265
|
240 + if (str_len > 0)
|
pankso@12265
|
241 + /* some nonzero digits in fractional part */
|
pankso@12265
|
242 + {
|
pankso@12265
|
243 + if (str_len > INT_MAX)
|
pankso@12265
|
244 + /* too many digits in fractional part */
|
pankso@12265
|
245 + return -1;
|
pankso@12265
|
246 +
|
pankso@12265
|
247 + np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
248 + np->fp_ptr = str;
|
pankso@12265
|
249 + np->fp_size = str_len;
|
pankso@12265
|
250 + }
|
pankso@12265
|
251
|
pankso@12265
|
252 - np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
253 - np->fp_ptr = str + np->ip_size;
|
pankso@12265
|
254 - np->fp_size = spec.prec;
|
pankso@12265
|
255 - }
|
pankso@12265
|
256 - else if (spec.alt)
|
pankso@12265
|
257 - np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
258 + if (keep_trailing_zeros && str_len < spec.prec)
|
pankso@12265
|
259 + /* add missing trailing zeros */
|
pankso@12265
|
260 + {
|
pankso@12265
|
261 + np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
262 + np->fp_trailing_zeros = spec.prec - np->fp_size;
|
pankso@12265
|
263 }
|
pankso@12265
|
264 +
|
pankso@12265
|
265 + if (spec.alt)
|
pankso@12265
|
266 + /* add decimal point even if no digits follow it */
|
pankso@12265
|
267 + np->point = MPFR_DECIMAL_POINT;
|
pankso@12265
|
268 }
|
pankso@12265
|
269
|
pankso@12265
|
270 return 0;
|
pankso@12265
|
271 diff -Naur mpfr-3.1.0.orig/src/version.c mpfr-3.1.0/src/version.c
|
pankso@12265
|
272 --- mpfr-3.1.0.orig/src/version.c 2011-10-03 08:17:09.000000000 +0000
|
pankso@12265
|
273 +++ mpfr-3.1.0/src/version.c 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
274 @@ -25,5 +25,5 @@
|
pankso@12265
|
275 const char *
|
pankso@12265
|
276 mpfr_get_version (void)
|
pankso@12265
|
277 {
|
pankso@12265
|
278 - return "3.1.0";
|
pankso@12265
|
279 + return "3.1.0-p4";
|
pankso@12265
|
280 }
|
pankso@12265
|
281 diff -Naur mpfr-3.1.0.orig/tests/Makefile.am mpfr-3.1.0/tests/Makefile.am
|
pankso@12265
|
282 --- mpfr-3.1.0.orig/tests/Makefile.am 2011-10-03 08:17:14.000000000 +0000
|
pankso@12265
|
283 +++ mpfr-3.1.0/tests/Makefile.am 2011-10-03 08:17:14.000000000 +0000
|
pankso@12265
|
284 @@ -65,8 +65,24 @@
|
pankso@12265
|
285 TESTS = $(check_PROGRAMS)
|
pankso@12265
|
286 TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND)
|
pankso@12265
|
287
|
pankso@12265
|
288 -# Option to prevent libtool from generating wrapper scripts for the tests.
|
pankso@12265
|
289 +# The -no-install option prevents libtool from generating wrapper scripts
|
pankso@12265
|
290 +# for the tests.
|
pankso@12265
|
291 # This is useful to easily run the test scripts under valgrind or gdb.
|
pankso@12265
|
292 # See discussion http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28033
|
pankso@12265
|
293 # http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28140 in particular.
|
pankso@12265
|
294 -AM_LDFLAGS = -no-install
|
pankso@12265
|
295 +#
|
pankso@12265
|
296 +# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
|
pankso@12265
|
297 +# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
|
pankso@12265
|
298 +# library is already installed in the corresponding lib directory: its
|
pankso@12265
|
299 +# purpose is to make sure that the local .libs comes first in the library
|
pankso@12265
|
300 +# search path (otherwise the tests are linked against the old MPFR library
|
pankso@12265
|
301 +# by the LINK command -- see the generated Makefile). See:
|
pankso@12265
|
302 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00042.html
|
pankso@12265
|
303 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00043.html
|
pankso@12265
|
304 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00044.html
|
pankso@12265
|
305 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00066.html
|
pankso@12265
|
306 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00065.html
|
pankso@12265
|
307 +# and
|
pankso@12265
|
308 +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
|
pankso@12265
|
309 +#
|
pankso@12265
|
310 +AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
|
pankso@12265
|
311 diff -Naur mpfr-3.1.0.orig/tests/Makefile.in mpfr-3.1.0/tests/Makefile.in
|
pankso@12265
|
312 --- mpfr-3.1.0.orig/tests/Makefile.in 2011-10-03 08:17:35.000000000 +0000
|
pankso@12265
|
313 +++ mpfr-3.1.0/tests/Makefile.in 2011-10-03 08:17:35.000000000 +0000
|
pankso@12265
|
314 @@ -1124,11 +1124,27 @@
|
pankso@12265
|
315 TESTS = $(check_PROGRAMS)
|
pankso@12265
|
316 TESTS_ENVIRONMENT = MPFR_QUIET=1 $(VALGRIND)
|
pankso@12265
|
317
|
pankso@12265
|
318 -# Option to prevent libtool from generating wrapper scripts for the tests.
|
pankso@12265
|
319 +# The -no-install option prevents libtool from generating wrapper scripts
|
pankso@12265
|
320 +# for the tests.
|
pankso@12265
|
321 # This is useful to easily run the test scripts under valgrind or gdb.
|
pankso@12265
|
322 # See discussion http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28033
|
pankso@12265
|
323 # http://article.gmane.org/gmane.comp.lib.gnulib.bugs/28140 in particular.
|
pankso@12265
|
324 -AM_LDFLAGS = -no-install
|
pankso@12265
|
325 +#
|
pankso@12265
|
326 +# The -L$(top_builddir)/src/.libs option is necessary for some platforms,
|
pankso@12265
|
327 +# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR
|
pankso@12265
|
328 +# library is already installed in the corresponding lib directory: its
|
pankso@12265
|
329 +# purpose is to make sure that the local .libs comes first in the library
|
pankso@12265
|
330 +# search path (otherwise the tests are linked against the old MPFR library
|
pankso@12265
|
331 +# by the LINK command -- see the generated Makefile). See:
|
pankso@12265
|
332 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00042.html
|
pankso@12265
|
333 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00043.html
|
pankso@12265
|
334 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00044.html
|
pankso@12265
|
335 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00066.html
|
pankso@12265
|
336 +# http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00065.html
|
pankso@12265
|
337 +# and
|
pankso@12265
|
338 +# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728
|
pankso@12265
|
339 +#
|
pankso@12265
|
340 +AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs
|
pankso@12265
|
341 all: all-am
|
pankso@12265
|
342
|
pankso@12265
|
343 .SUFFIXES:
|
pankso@12265
|
344 diff -Naur mpfr-3.1.0.orig/tests/trandom.c mpfr-3.1.0/tests/trandom.c
|
pankso@12265
|
345 --- mpfr-3.1.0.orig/tests/trandom.c 2011-10-03 08:17:14.000000000 +0000
|
pankso@12265
|
346 +++ mpfr-3.1.0/tests/trandom.c 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
347 @@ -114,21 +114,29 @@
|
pankso@12265
|
348 mpfr_t x;
|
pankso@12265
|
349 gmp_randstate_t s;
|
pankso@12265
|
350
|
pankso@12265
|
351 +#if __MPFR_GMP(4,2,0)
|
pankso@12265
|
352 +# define C1 "0.895943"
|
pankso@12265
|
353 +# define C2 "0.848824"
|
pankso@12265
|
354 +#else
|
pankso@12265
|
355 +# define C1 "0.479652"
|
pankso@12265
|
356 +# define C2 "0.648529"
|
pankso@12265
|
357 +#endif
|
pankso@12265
|
358 +
|
pankso@12265
|
359 gmp_randinit_default (s);
|
pankso@12265
|
360 gmp_randseed_ui (s, 42);
|
pankso@12265
|
361 mpfr_init2 (x, 17);
|
pankso@12265
|
362 mpfr_urandomb (x, s);
|
pankso@12265
|
363 - if (mpfr_cmp_str1 (x, "0.895943") != 0)
|
pankso@12265
|
364 + if (mpfr_cmp_str1 (x, C1) != 0)
|
pankso@12265
|
365 {
|
pankso@12265
|
366 - printf ("Error in bug20100914, expected 0.895943, got ");
|
pankso@12265
|
367 + printf ("Error in bug20100914, expected " C1 ", got ");
|
pankso@12265
|
368 mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
|
pankso@12265
|
369 printf ("\n");
|
pankso@12265
|
370 exit (1);
|
pankso@12265
|
371 }
|
pankso@12265
|
372 mpfr_urandomb (x, s);
|
pankso@12265
|
373 - if (mpfr_cmp_str1 (x, "0.848824") != 0)
|
pankso@12265
|
374 + if (mpfr_cmp_str1 (x, C2) != 0)
|
pankso@12265
|
375 {
|
pankso@12265
|
376 - printf ("Error in bug20100914, expected 0.848824, got ");
|
pankso@12265
|
377 + printf ("Error in bug20100914, expected " C2 ", got ");
|
pankso@12265
|
378 mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
|
pankso@12265
|
379 printf ("\n");
|
pankso@12265
|
380 exit (1);
|
pankso@12265
|
381 diff -Naur mpfr-3.1.0.orig/tests/tsprintf.c mpfr-3.1.0/tests/tsprintf.c
|
pankso@12265
|
382 --- mpfr-3.1.0.orig/tests/tsprintf.c 2011-10-03 08:17:14.000000000 +0000
|
pankso@12265
|
383 +++ mpfr-3.1.0/tests/tsprintf.c 2011-11-03 15:15:11.000000000 +0000
|
pankso@12265
|
384 @@ -475,6 +475,18 @@
|
pankso@12265
|
385 check_sprintf ("-1.", "%- #0.1RG", x);
|
pankso@12265
|
386
|
pankso@12265
|
387 /* precision zero */
|
pankso@12265
|
388 + mpfr_set_d (x, 9.5, MPFR_RNDN);
|
pankso@12265
|
389 + check_sprintf ("9", "%.0RDf", x);
|
pankso@12265
|
390 + check_sprintf ("10", "%.0RUf", x);
|
pankso@12265
|
391 +
|
pankso@12265
|
392 + mpfr_set_d (x, 19.5, MPFR_RNDN);
|
pankso@12265
|
393 + check_sprintf ("19", "%.0RDf", x);
|
pankso@12265
|
394 + check_sprintf ("20", "%.0RUf", x);
|
pankso@12265
|
395 +
|
pankso@12265
|
396 + mpfr_set_d (x, 99.5, MPFR_RNDN);
|
pankso@12265
|
397 + check_sprintf ("99", "%.0RDf", x);
|
pankso@12265
|
398 + check_sprintf ("100", "%.0RUf", x);
|
pankso@12265
|
399 +
|
pankso@12265
|
400 mpfr_set_d (x, -9.5, MPFR_RNDN);
|
pankso@12265
|
401 check_sprintf ("-10", "%.0RDf", x);
|
pankso@12265
|
402 check_sprintf ("-10", "%.0RYf", x);
|
pankso@12265
|
403 @@ -1078,6 +1090,23 @@
|
pankso@12265
|
404 mpfr_clear (x);
|
pankso@12265
|
405 }
|
pankso@12265
|
406
|
pankso@12265
|
407 +static void
|
pankso@12265
|
408 +bug20111102 (void)
|
pankso@12265
|
409 +{
|
pankso@12265
|
410 + mpfr_t t;
|
pankso@12265
|
411 + char s[100];
|
pankso@12265
|
412 +
|
pankso@12265
|
413 + mpfr_init2 (t, 84);
|
pankso@12265
|
414 + mpfr_set_str (t, "999.99999999999999999999", 10, MPFR_RNDN);
|
pankso@12265
|
415 + mpfr_sprintf (s, "%.20RNg", t);
|
pankso@12265
|
416 + if (strcmp (s, "1000") != 0)
|
pankso@12265
|
417 + {
|
pankso@12265
|
418 + printf ("Error in bug20111102, expected 1000, got %s\n", s);
|
pankso@12265
|
419 + exit (1);
|
pankso@12265
|
420 + }
|
pankso@12265
|
421 + mpfr_clear (t);
|
pankso@12265
|
422 +}
|
pankso@12265
|
423 +
|
pankso@12265
|
424 /* In particular, the following test makes sure that the rounding
|
pankso@12265
|
425 * for %Ra and %Rb is not done on the MPFR number itself (as it
|
pankso@12265
|
426 * would overflow). Note: it has been reported on comp.std.c that
|
pankso@12265
|
427 @@ -1161,6 +1190,7 @@
|
pankso@12265
|
428 locale = setlocale (LC_ALL, "C");
|
pankso@12265
|
429 #endif
|
pankso@12265
|
430
|
pankso@12265
|
431 + bug20111102 ();
|
pankso@12265
|
432 native_types ();
|
pankso@12265
|
433 hexadecimal ();
|
pankso@12265
|
434 binary ();
|
pankso@12265
|
435 diff -Naur mpfr-3.1.0.orig/tests/turandom.c mpfr-3.1.0/tests/turandom.c
|
pankso@12265
|
436 --- mpfr-3.1.0.orig/tests/turandom.c 2011-10-03 08:17:14.000000000 +0000
|
pankso@12265
|
437 +++ mpfr-3.1.0/tests/turandom.c 2011-11-28 12:22:52.000000000 +0000
|
pankso@12265
|
438 @@ -160,23 +160,29 @@
|
pankso@12265
|
439 mpfr_t x;
|
pankso@12265
|
440 gmp_randstate_t s;
|
pankso@12265
|
441
|
pankso@12265
|
442 +#if __MPFR_GMP(4,2,0)
|
pankso@12265
|
443 +# define C1 "0.8488312"
|
pankso@12265
|
444 +# define C2 "0.8156509"
|
pankso@12265
|
445 +#else
|
pankso@12265
|
446 +# define C1 "0.6485367"
|
pankso@12265
|
447 +# define C2 "0.9362717"
|
pankso@12265
|
448 +#endif
|
pankso@12265
|
449 +
|
pankso@12265
|
450 gmp_randinit_default (s);
|
pankso@12265
|
451 gmp_randseed_ui (s, 42);
|
pankso@12265
|
452 mpfr_init2 (x, 17);
|
pankso@12265
|
453 mpfr_urandom (x, s, MPFR_RNDN);
|
pankso@12265
|
454 - /* the following values are obtained on a 32-bit computer, we should get
|
pankso@12265
|
455 - the same values on a 64-bit computer */
|
pankso@12265
|
456 - if (mpfr_cmp_str1 (x, "0.8488312") != 0)
|
pankso@12265
|
457 + if (mpfr_cmp_str1 (x, C1) != 0)
|
pankso@12265
|
458 {
|
pankso@12265
|
459 - printf ("Error in bug20100914, expected 0.8488312, got ");
|
pankso@12265
|
460 + printf ("Error in bug20100914, expected " C1 ", got ");
|
pankso@12265
|
461 mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
|
pankso@12265
|
462 printf ("\n");
|
pankso@12265
|
463 exit (1);
|
pankso@12265
|
464 }
|
pankso@12265
|
465 mpfr_urandom (x, s, MPFR_RNDN);
|
pankso@12265
|
466 - if (mpfr_cmp_str1 (x, "0.8156509") != 0)
|
pankso@12265
|
467 + if (mpfr_cmp_str1 (x, C2) != 0)
|
pankso@12265
|
468 {
|
pankso@12265
|
469 - printf ("Error in bug20100914, expected 0.8156509, got ");
|
pankso@12265
|
470 + printf ("Error in bug20100914, expected " C2 ", got ");
|
pankso@12265
|
471 mpfr_out_str (stdout, 10, 0, x, MPFR_RNDN);
|
pankso@12265
|
472 printf ("\n");
|
pankso@12265
|
473 exit (1);
|