rev |
line source |
slaxemulator@7497
|
1 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
2 --- mpfr-3.0.0-a/PATCHES 2010-06-23 11:02:49.000000000 +0000
|
slaxemulator@7497
|
3 +++ mpfr-3.0.0-b/PATCHES 2010-06-23 11:03:36.000000000 +0000
|
slaxemulator@7497
|
4 @@ -0,0 +1 @@
|
slaxemulator@7497
|
5 +mpfr_out_str
|
slaxemulator@7497
|
6 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
7 --- mpfr-3.0.0-a/VERSION 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
8 +++ mpfr-3.0.0-b/VERSION 2010-06-23 11:03:20.000000000 +0000
|
slaxemulator@7497
|
9 @@ -1 +1 @@
|
slaxemulator@7497
|
10 -3.0.0
|
slaxemulator@7497
|
11 +3.0.0-p1
|
slaxemulator@7497
|
12 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
13 --- mpfr-3.0.0-a/mpfr.h 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
14 +++ mpfr-3.0.0-b/mpfr.h 2010-06-23 11:03:20.000000000 +0000
|
slaxemulator@7497
|
15 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
16 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
17 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
18 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
19 -#define MPFR_VERSION_STRING "3.0.0"
|
slaxemulator@7497
|
20 +#define MPFR_VERSION_STRING "3.0.0-p1"
|
slaxemulator@7497
|
21
|
slaxemulator@7497
|
22 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
23 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
24 diff -Naurd mpfr-3.0.0-a/mpfr.texi mpfr-3.0.0-b/mpfr.texi
|
slaxemulator@7497
|
25 --- mpfr-3.0.0-a/mpfr.texi 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
26 +++ mpfr-3.0.0-b/mpfr.texi 2010-06-23 11:03:12.000000000 +0000
|
slaxemulator@7497
|
27 @@ -2050,7 +2050,7 @@
|
slaxemulator@7497
|
28 are printed. If @var{base} is greater than 10, @samp{@@} will be used
|
slaxemulator@7497
|
29 instead of @samp{e} as exponent delimiter.
|
slaxemulator@7497
|
30
|
slaxemulator@7497
|
31 -Return the number of bytes written, or if an error occurred, return 0.
|
slaxemulator@7497
|
32 +Return the number of characters written, or if an error occurred, return 0.
|
slaxemulator@7497
|
33 @end deftypefun
|
slaxemulator@7497
|
34
|
slaxemulator@7497
|
35 @deftypefun size_t mpfr_inp_str (mpfr_t @var{rop}, FILE *@var{stream}, int @var{base}, mpfr_rnd_t @var{rnd})
|
slaxemulator@7497
|
36 diff -Naurd mpfr-3.0.0-a/out_str.c mpfr-3.0.0-b/out_str.c
|
slaxemulator@7497
|
37 --- mpfr-3.0.0-a/out_str.c 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
38 +++ mpfr-3.0.0-b/out_str.c 2010-06-23 11:03:12.000000000 +0000
|
slaxemulator@7497
|
39 @@ -22,6 +22,16 @@
|
slaxemulator@7497
|
40
|
slaxemulator@7497
|
41 #include "mpfr-impl.h"
|
slaxemulator@7497
|
42
|
slaxemulator@7497
|
43 +/* Warning! S should not contain "%". */
|
slaxemulator@7497
|
44 +#define OUT_STR_RET(S) \
|
slaxemulator@7497
|
45 + do \
|
slaxemulator@7497
|
46 + { \
|
slaxemulator@7497
|
47 + int r; \
|
slaxemulator@7497
|
48 + r = fprintf (stream, (S)); \
|
slaxemulator@7497
|
49 + return r < 0 ? 0 : r; \
|
slaxemulator@7497
|
50 + } \
|
slaxemulator@7497
|
51 + while (0)
|
slaxemulator@7497
|
52 +
|
slaxemulator@7497
|
53 size_t
|
slaxemulator@7497
|
54 mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
|
slaxemulator@7497
|
55 mpfr_rnd_t rnd_mode)
|
slaxemulator@7497
|
56 @@ -29,6 +39,7 @@
|
slaxemulator@7497
|
57 char *s, *s0;
|
slaxemulator@7497
|
58 size_t l;
|
slaxemulator@7497
|
59 mpfr_exp_t e;
|
slaxemulator@7497
|
60 + int err;
|
slaxemulator@7497
|
61
|
slaxemulator@7497
|
62 MPFR_ASSERTN (base >= 2 && base <= 62);
|
slaxemulator@7497
|
63
|
slaxemulator@7497
|
64 @@ -36,37 +47,16 @@
|
slaxemulator@7497
|
65 if (stream == NULL)
|
slaxemulator@7497
|
66 stream = stdout;
|
slaxemulator@7497
|
67
|
slaxemulator@7497
|
68 - if (MPFR_IS_NAN(op))
|
slaxemulator@7497
|
69 - {
|
slaxemulator@7497
|
70 - fprintf (stream, "@NaN@");
|
slaxemulator@7497
|
71 - return 3;
|
slaxemulator@7497
|
72 - }
|
slaxemulator@7497
|
73 -
|
slaxemulator@7497
|
74 - if (MPFR_IS_INF(op))
|
slaxemulator@7497
|
75 - {
|
slaxemulator@7497
|
76 - if (MPFR_SIGN(op) > 0)
|
slaxemulator@7497
|
77 - {
|
slaxemulator@7497
|
78 - fprintf (stream, "@Inf@");
|
slaxemulator@7497
|
79 - return 3;
|
slaxemulator@7497
|
80 - }
|
slaxemulator@7497
|
81 - else
|
slaxemulator@7497
|
82 - {
|
slaxemulator@7497
|
83 - fprintf (stream, "-@Inf@");
|
slaxemulator@7497
|
84 - return 4;
|
slaxemulator@7497
|
85 - }
|
slaxemulator@7497
|
86 - }
|
slaxemulator@7497
|
87 -
|
slaxemulator@7497
|
88 - if (MPFR_IS_ZERO(op))
|
slaxemulator@7497
|
89 + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op)))
|
slaxemulator@7497
|
90 {
|
slaxemulator@7497
|
91 - if (MPFR_SIGN(op) > 0)
|
slaxemulator@7497
|
92 - {
|
slaxemulator@7497
|
93 - fprintf(stream, "0");
|
slaxemulator@7497
|
94 - return 1;
|
slaxemulator@7497
|
95 - }
|
slaxemulator@7497
|
96 + if (MPFR_IS_NAN (op))
|
slaxemulator@7497
|
97 + OUT_STR_RET ("@NaN@");
|
slaxemulator@7497
|
98 + else if (MPFR_IS_INF (op))
|
slaxemulator@7497
|
99 + OUT_STR_RET (MPFR_IS_POS (op) ? "@Inf@" : "-@Inf@");
|
slaxemulator@7497
|
100 else
|
slaxemulator@7497
|
101 {
|
slaxemulator@7497
|
102 - fprintf(stream, "-0");
|
slaxemulator@7497
|
103 - return 2;
|
slaxemulator@7497
|
104 + MPFR_ASSERTD (MPFR_IS_ZERO (op));
|
slaxemulator@7497
|
105 + OUT_STR_RET (MPFR_IS_POS (op) ? "0" : "-0");
|
slaxemulator@7497
|
106 }
|
slaxemulator@7497
|
107 }
|
slaxemulator@7497
|
108
|
slaxemulator@7497
|
109 @@ -77,21 +67,31 @@
|
slaxemulator@7497
|
110
|
slaxemulator@7497
|
111 l = strlen (s) + 1; /* size of allocated block returned by mpfr_get_str
|
slaxemulator@7497
|
112 - may be incorrect, as only an upper bound? */
|
slaxemulator@7497
|
113 - if (*s == '-')
|
slaxemulator@7497
|
114 - fputc (*s++, stream);
|
slaxemulator@7497
|
115
|
slaxemulator@7497
|
116 - /* outputs mantissa */
|
slaxemulator@7497
|
117 - fputc (*s++, stream); e--; /* leading digit */
|
slaxemulator@7497
|
118 - fputc ((unsigned char) MPFR_DECIMAL_POINT, stream);
|
slaxemulator@7497
|
119 - fputs (s, stream); /* rest of mantissa */
|
slaxemulator@7497
|
120 + /* outputs possible sign and significand */
|
slaxemulator@7497
|
121 + err = (*s == '-' && fputc (*s++, stream) == EOF)
|
slaxemulator@7497
|
122 + || fputc (*s++, stream) == EOF /* leading digit */
|
slaxemulator@7497
|
123 + || fputc ((unsigned char) MPFR_DECIMAL_POINT, stream) == EOF
|
slaxemulator@7497
|
124 + || fputs (s, stream) == EOF; /* trailing significand */
|
slaxemulator@7497
|
125 (*__gmp_free_func) (s0, l);
|
slaxemulator@7497
|
126 + if (MPFR_UNLIKELY (err))
|
slaxemulator@7497
|
127 + return 0;
|
slaxemulator@7497
|
128 +
|
slaxemulator@7497
|
129 + e--; /* due to the leading digit */
|
slaxemulator@7497
|
130
|
slaxemulator@7497
|
131 /* outputs exponent */
|
slaxemulator@7497
|
132 if (e)
|
slaxemulator@7497
|
133 {
|
slaxemulator@7497
|
134 + int r;
|
slaxemulator@7497
|
135 +
|
slaxemulator@7497
|
136 MPFR_ASSERTN(e >= LONG_MIN);
|
slaxemulator@7497
|
137 MPFR_ASSERTN(e <= LONG_MAX);
|
slaxemulator@7497
|
138 - l += fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
|
slaxemulator@7497
|
139 +
|
slaxemulator@7497
|
140 + r = fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
|
slaxemulator@7497
|
141 + if (MPFR_UNLIKELY (r < 0))
|
slaxemulator@7497
|
142 + return 0;
|
slaxemulator@7497
|
143 +
|
slaxemulator@7497
|
144 + l += r;
|
slaxemulator@7497
|
145 }
|
slaxemulator@7497
|
146
|
slaxemulator@7497
|
147 return l;
|
slaxemulator@7497
|
148 diff -Naurd mpfr-3.0.0-a/tests/tout_str.c mpfr-3.0.0-b/tests/tout_str.c
|
slaxemulator@7497
|
149 --- mpfr-3.0.0-a/tests/tout_str.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
150 +++ mpfr-3.0.0-b/tests/tout_str.c 2010-06-23 11:03:12.000000000 +0000
|
slaxemulator@7497
|
151 @@ -46,22 +46,54 @@
|
slaxemulator@7497
|
152 special (void)
|
slaxemulator@7497
|
153 {
|
slaxemulator@7497
|
154 mpfr_t x;
|
slaxemulator@7497
|
155 + unsigned int n;
|
slaxemulator@7497
|
156
|
slaxemulator@7497
|
157 mpfr_init (x);
|
slaxemulator@7497
|
158
|
slaxemulator@7497
|
159 mpfr_set_nan (x);
|
slaxemulator@7497
|
160 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
161 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
162 + if (n != 5)
|
slaxemulator@7497
|
163 + {
|
slaxemulator@7497
|
164 + printf ("Error: mpfr_out_str (file, 10, 0, NaN, MPFR_RNDN) wrote %u "
|
slaxemulator@7497
|
165 + "characters instead of 5.\n", n);
|
slaxemulator@7497
|
166 + exit (1);
|
slaxemulator@7497
|
167 + }
|
slaxemulator@7497
|
168
|
slaxemulator@7497
|
169 mpfr_set_inf (x, 1);
|
slaxemulator@7497
|
170 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
171 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
172 + if (n != 5)
|
slaxemulator@7497
|
173 + {
|
slaxemulator@7497
|
174 + printf ("Error: mpfr_out_str (file, 10, 0, +Inf, MPFR_RNDN) wrote %u "
|
slaxemulator@7497
|
175 + "characters instead of 5.\n", n);
|
slaxemulator@7497
|
176 + exit (1);
|
slaxemulator@7497
|
177 + }
|
slaxemulator@7497
|
178
|
slaxemulator@7497
|
179 mpfr_set_inf (x, -1);
|
slaxemulator@7497
|
180 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
181 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
182 + if (n != 6)
|
slaxemulator@7497
|
183 + {
|
slaxemulator@7497
|
184 + printf ("Error: mpfr_out_str (file, 10, 0, -Inf, MPFR_RNDN) wrote %u "
|
slaxemulator@7497
|
185 + "characters instead of 6.\n", n);
|
slaxemulator@7497
|
186 + exit (1);
|
slaxemulator@7497
|
187 + }
|
slaxemulator@7497
|
188
|
slaxemulator@7497
|
189 mpfr_set_ui (x, 0, MPFR_RNDN);
|
slaxemulator@7497
|
190 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
191 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
192 + if (n != 1)
|
slaxemulator@7497
|
193 + {
|
slaxemulator@7497
|
194 + printf ("Error: mpfr_out_str (file, 10, 0, +0, MPFR_RNDN) wrote %u "
|
slaxemulator@7497
|
195 + "characters instead of 1.\n", n);
|
slaxemulator@7497
|
196 + exit (1);
|
slaxemulator@7497
|
197 + }
|
slaxemulator@7497
|
198 +
|
slaxemulator@7497
|
199 mpfr_neg (x, x, MPFR_RNDN);
|
slaxemulator@7497
|
200 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
201 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
|
slaxemulator@7497
|
202 + if (n != 2)
|
slaxemulator@7497
|
203 + {
|
slaxemulator@7497
|
204 + printf ("Error: mpfr_out_str (file, 10, 0, -0, MPFR_RNDN) wrote %u "
|
slaxemulator@7497
|
205 + "characters instead of 2.\n", n);
|
slaxemulator@7497
|
206 + exit (1);
|
slaxemulator@7497
|
207 + }
|
slaxemulator@7497
|
208
|
slaxemulator@7497
|
209 mpfr_clear (x);
|
slaxemulator@7497
|
210 }
|
slaxemulator@7497
|
211 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
212 --- mpfr-3.0.0-a/version.c 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
213 +++ mpfr-3.0.0-b/version.c 2010-06-23 11:03:20.000000000 +0000
|
slaxemulator@7497
|
214 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
215 const char *
|
slaxemulator@7497
|
216 mpfr_get_version (void)
|
slaxemulator@7497
|
217 {
|
slaxemulator@7497
|
218 - return "3.0.0";
|
slaxemulator@7497
|
219 + return "3.0.0-p1";
|
slaxemulator@7497
|
220 }
|
slaxemulator@7497
|
221 diff -Naurd mpfr-3.0.0-a/Makefile.in mpfr-3.0.0-b/Makefile.in
|
slaxemulator@7497
|
222 --- mpfr-3.0.0-a/Makefile.in 2010-06-10 11:00:52.000000000 +0000
|
slaxemulator@7497
|
223 +++ mpfr-3.0.0-b/Makefile.in 2010-06-10 11:00:52.000000000 +0000
|
slaxemulator@7497
|
224 @@ -239,6 +239,7 @@
|
slaxemulator@7497
|
225 distuninstallcheck_listfiles = find . -type f -print
|
slaxemulator@7497
|
226 distcleancheck_listfiles = find . -type f -print
|
slaxemulator@7497
|
227 ACLOCAL = @ACLOCAL@
|
slaxemulator@7497
|
228 +ALLOCA = @ALLOCA@
|
slaxemulator@7497
|
229 AMTAR = @AMTAR@
|
slaxemulator@7497
|
230 AR = @AR@
|
slaxemulator@7497
|
231 AS = @AS@
|
slaxemulator@7497
|
232 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
233 --- mpfr-3.0.0-a/PATCHES 2010-06-23 11:03:36.000000000 +0000
|
slaxemulator@7497
|
234 +++ mpfr-3.0.0-b/PATCHES 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
235 @@ -0,0 +1 @@
|
slaxemulator@7497
|
236 +alloca
|
slaxemulator@7497
|
237 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
238 --- mpfr-3.0.0-a/VERSION 2010-06-23 11:03:20.000000000 +0000
|
slaxemulator@7497
|
239 +++ mpfr-3.0.0-b/VERSION 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
240 @@ -1 +1 @@
|
slaxemulator@7497
|
241 -3.0.0-p1
|
slaxemulator@7497
|
242 +3.0.0-p2
|
slaxemulator@7497
|
243 diff -Naurd mpfr-3.0.0-a/acinclude.m4 mpfr-3.0.0-b/acinclude.m4
|
slaxemulator@7497
|
244 --- mpfr-3.0.0-a/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
245 +++ mpfr-3.0.0-b/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
246 @@ -59,6 +59,9 @@
|
slaxemulator@7497
|
247 dnl sys/fpu.h - MIPS specific
|
slaxemulator@7497
|
248 AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
|
slaxemulator@7497
|
249
|
slaxemulator@7497
|
250 +dnl Check how to get `alloca'
|
slaxemulator@7497
|
251 +AC_FUNC_ALLOCA
|
slaxemulator@7497
|
252 +
|
slaxemulator@7497
|
253 dnl SIZE_MAX macro
|
slaxemulator@7497
|
254 gl_SIZE_MAX
|
slaxemulator@7497
|
255
|
slaxemulator@7497
|
256 diff -Naurd mpfr-3.0.0-a/configure mpfr-3.0.0-b/configure
|
slaxemulator@7497
|
257 --- mpfr-3.0.0-a/configure 2010-06-10 11:00:51.000000000 +0000
|
slaxemulator@7497
|
258 +++ mpfr-3.0.0-b/configure 2010-06-25 13:23:05.000000000 +0000
|
slaxemulator@7497
|
259 @@ -783,6 +783,7 @@
|
slaxemulator@7497
|
260 OBJDUMP
|
slaxemulator@7497
|
261 DLLTOOL
|
slaxemulator@7497
|
262 AS
|
slaxemulator@7497
|
263 +ALLOCA
|
slaxemulator@7497
|
264 MPFR_LIBM
|
slaxemulator@7497
|
265 ANSI2KNR
|
slaxemulator@7497
|
266 U
|
slaxemulator@7497
|
267 @@ -5622,6 +5623,197 @@
|
slaxemulator@7497
|
268 done
|
slaxemulator@7497
|
269
|
slaxemulator@7497
|
270
|
slaxemulator@7497
|
271 +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
slaxemulator@7497
|
272 +# for constant arguments. Useless!
|
slaxemulator@7497
|
273 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
|
slaxemulator@7497
|
274 +$as_echo_n "checking for working alloca.h... " >&6; }
|
slaxemulator@7497
|
275 +if test "${ac_cv_working_alloca_h+set}" = set; then :
|
slaxemulator@7497
|
276 + $as_echo_n "(cached) " >&6
|
slaxemulator@7497
|
277 +else
|
slaxemulator@7497
|
278 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
slaxemulator@7497
|
279 +/* end confdefs.h. */
|
slaxemulator@7497
|
280 +#include <alloca.h>
|
slaxemulator@7497
|
281 +int
|
slaxemulator@7497
|
282 +main ()
|
slaxemulator@7497
|
283 +{
|
slaxemulator@7497
|
284 +char *p = (char *) alloca (2 * sizeof (int));
|
slaxemulator@7497
|
285 + if (p) return 0;
|
slaxemulator@7497
|
286 + ;
|
slaxemulator@7497
|
287 + return 0;
|
slaxemulator@7497
|
288 +}
|
slaxemulator@7497
|
289 +_ACEOF
|
slaxemulator@7497
|
290 +if ac_fn_c_try_link "$LINENO"; then :
|
slaxemulator@7497
|
291 + ac_cv_working_alloca_h=yes
|
slaxemulator@7497
|
292 +else
|
slaxemulator@7497
|
293 + ac_cv_working_alloca_h=no
|
slaxemulator@7497
|
294 +fi
|
slaxemulator@7497
|
295 +rm -f core conftest.err conftest.$ac_objext \
|
slaxemulator@7497
|
296 + conftest$ac_exeext conftest.$ac_ext
|
slaxemulator@7497
|
297 +fi
|
slaxemulator@7497
|
298 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
|
slaxemulator@7497
|
299 +$as_echo "$ac_cv_working_alloca_h" >&6; }
|
slaxemulator@7497
|
300 +if test $ac_cv_working_alloca_h = yes; then
|
slaxemulator@7497
|
301 +
|
slaxemulator@7497
|
302 +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
|
slaxemulator@7497
|
303 +
|
slaxemulator@7497
|
304 +fi
|
slaxemulator@7497
|
305 +
|
slaxemulator@7497
|
306 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
|
slaxemulator@7497
|
307 +$as_echo_n "checking for alloca... " >&6; }
|
slaxemulator@7497
|
308 +if test "${ac_cv_func_alloca_works+set}" = set; then :
|
slaxemulator@7497
|
309 + $as_echo_n "(cached) " >&6
|
slaxemulator@7497
|
310 +else
|
slaxemulator@7497
|
311 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
slaxemulator@7497
|
312 +/* end confdefs.h. */
|
slaxemulator@7497
|
313 +#ifdef __GNUC__
|
slaxemulator@7497
|
314 +# define alloca __builtin_alloca
|
slaxemulator@7497
|
315 +#else
|
slaxemulator@7497
|
316 +# ifdef _MSC_VER
|
slaxemulator@7497
|
317 +# include <malloc.h>
|
slaxemulator@7497
|
318 +# define alloca _alloca
|
slaxemulator@7497
|
319 +# else
|
slaxemulator@7497
|
320 +# ifdef HAVE_ALLOCA_H
|
slaxemulator@7497
|
321 +# include <alloca.h>
|
slaxemulator@7497
|
322 +# else
|
slaxemulator@7497
|
323 +# ifdef _AIX
|
slaxemulator@7497
|
324 + #pragma alloca
|
slaxemulator@7497
|
325 +# else
|
slaxemulator@7497
|
326 +# ifndef alloca /* predefined by HP cc +Olibcalls */
|
slaxemulator@7497
|
327 +char *alloca ();
|
slaxemulator@7497
|
328 +# endif
|
slaxemulator@7497
|
329 +# endif
|
slaxemulator@7497
|
330 +# endif
|
slaxemulator@7497
|
331 +# endif
|
slaxemulator@7497
|
332 +#endif
|
slaxemulator@7497
|
333 +
|
slaxemulator@7497
|
334 +int
|
slaxemulator@7497
|
335 +main ()
|
slaxemulator@7497
|
336 +{
|
slaxemulator@7497
|
337 +char *p = (char *) alloca (1);
|
slaxemulator@7497
|
338 + if (p) return 0;
|
slaxemulator@7497
|
339 + ;
|
slaxemulator@7497
|
340 + return 0;
|
slaxemulator@7497
|
341 +}
|
slaxemulator@7497
|
342 +_ACEOF
|
slaxemulator@7497
|
343 +if ac_fn_c_try_link "$LINENO"; then :
|
slaxemulator@7497
|
344 + ac_cv_func_alloca_works=yes
|
slaxemulator@7497
|
345 +else
|
slaxemulator@7497
|
346 + ac_cv_func_alloca_works=no
|
slaxemulator@7497
|
347 +fi
|
slaxemulator@7497
|
348 +rm -f core conftest.err conftest.$ac_objext \
|
slaxemulator@7497
|
349 + conftest$ac_exeext conftest.$ac_ext
|
slaxemulator@7497
|
350 +fi
|
slaxemulator@7497
|
351 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
|
slaxemulator@7497
|
352 +$as_echo "$ac_cv_func_alloca_works" >&6; }
|
slaxemulator@7497
|
353 +
|
slaxemulator@7497
|
354 +if test $ac_cv_func_alloca_works = yes; then
|
slaxemulator@7497
|
355 +
|
slaxemulator@7497
|
356 +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
|
slaxemulator@7497
|
357 +
|
slaxemulator@7497
|
358 +else
|
slaxemulator@7497
|
359 + # The SVR3 libPW and SVR4 libucb both contain incompatible functions
|
slaxemulator@7497
|
360 +# that cause trouble. Some versions do not even contain alloca or
|
slaxemulator@7497
|
361 +# contain a buggy version. If you still want to use their alloca,
|
slaxemulator@7497
|
362 +# use ar to extract alloca.o from them instead of compiling alloca.c.
|
slaxemulator@7497
|
363 +
|
slaxemulator@7497
|
364 +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
|
slaxemulator@7497
|
365 +
|
slaxemulator@7497
|
366 +$as_echo "#define C_ALLOCA 1" >>confdefs.h
|
slaxemulator@7497
|
367 +
|
slaxemulator@7497
|
368 +
|
slaxemulator@7497
|
369 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
|
slaxemulator@7497
|
370 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
|
slaxemulator@7497
|
371 +if test "${ac_cv_os_cray+set}" = set; then :
|
slaxemulator@7497
|
372 + $as_echo_n "(cached) " >&6
|
slaxemulator@7497
|
373 +else
|
slaxemulator@7497
|
374 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
slaxemulator@7497
|
375 +/* end confdefs.h. */
|
slaxemulator@7497
|
376 +#if defined CRAY && ! defined CRAY2
|
slaxemulator@7497
|
377 +webecray
|
slaxemulator@7497
|
378 +#else
|
slaxemulator@7497
|
379 +wenotbecray
|
slaxemulator@7497
|
380 +#endif
|
slaxemulator@7497
|
381 +
|
slaxemulator@7497
|
382 +_ACEOF
|
slaxemulator@7497
|
383 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
slaxemulator@7497
|
384 + $EGREP "webecray" >/dev/null 2>&1; then :
|
slaxemulator@7497
|
385 + ac_cv_os_cray=yes
|
slaxemulator@7497
|
386 +else
|
slaxemulator@7497
|
387 + ac_cv_os_cray=no
|
slaxemulator@7497
|
388 +fi
|
slaxemulator@7497
|
389 +rm -f conftest*
|
slaxemulator@7497
|
390 +
|
slaxemulator@7497
|
391 +fi
|
slaxemulator@7497
|
392 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
|
slaxemulator@7497
|
393 +$as_echo "$ac_cv_os_cray" >&6; }
|
slaxemulator@7497
|
394 +if test $ac_cv_os_cray = yes; then
|
slaxemulator@7497
|
395 + for ac_func in _getb67 GETB67 getb67; do
|
slaxemulator@7497
|
396 + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
slaxemulator@7497
|
397 +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
|
slaxemulator@7497
|
398 +eval as_val=\$$as_ac_var
|
slaxemulator@7497
|
399 + if test "x$as_val" = x""yes; then :
|
slaxemulator@7497
|
400 +
|
slaxemulator@7497
|
401 +cat >>confdefs.h <<_ACEOF
|
slaxemulator@7497
|
402 +#define CRAY_STACKSEG_END $ac_func
|
slaxemulator@7497
|
403 +_ACEOF
|
slaxemulator@7497
|
404 +
|
slaxemulator@7497
|
405 + break
|
slaxemulator@7497
|
406 +fi
|
slaxemulator@7497
|
407 +
|
slaxemulator@7497
|
408 + done
|
slaxemulator@7497
|
409 +fi
|
slaxemulator@7497
|
410 +
|
slaxemulator@7497
|
411 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
|
slaxemulator@7497
|
412 +$as_echo_n "checking stack direction for C alloca... " >&6; }
|
slaxemulator@7497
|
413 +if test "${ac_cv_c_stack_direction+set}" = set; then :
|
slaxemulator@7497
|
414 + $as_echo_n "(cached) " >&6
|
slaxemulator@7497
|
415 +else
|
slaxemulator@7497
|
416 + if test "$cross_compiling" = yes; then :
|
slaxemulator@7497
|
417 + ac_cv_c_stack_direction=0
|
slaxemulator@7497
|
418 +else
|
slaxemulator@7497
|
419 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
slaxemulator@7497
|
420 +/* end confdefs.h. */
|
slaxemulator@7497
|
421 +$ac_includes_default
|
slaxemulator@7497
|
422 +int
|
slaxemulator@7497
|
423 +find_stack_direction ()
|
slaxemulator@7497
|
424 +{
|
slaxemulator@7497
|
425 + static char *addr = 0;
|
slaxemulator@7497
|
426 + auto char dummy;
|
slaxemulator@7497
|
427 + if (addr == 0)
|
slaxemulator@7497
|
428 + {
|
slaxemulator@7497
|
429 + addr = &dummy;
|
slaxemulator@7497
|
430 + return find_stack_direction ();
|
slaxemulator@7497
|
431 + }
|
slaxemulator@7497
|
432 + else
|
slaxemulator@7497
|
433 + return (&dummy > addr) ? 1 : -1;
|
slaxemulator@7497
|
434 +}
|
slaxemulator@7497
|
435 +
|
slaxemulator@7497
|
436 +int
|
slaxemulator@7497
|
437 +main ()
|
slaxemulator@7497
|
438 +{
|
slaxemulator@7497
|
439 + return find_stack_direction () < 0;
|
slaxemulator@7497
|
440 +}
|
slaxemulator@7497
|
441 +_ACEOF
|
slaxemulator@7497
|
442 +if ac_fn_c_try_run "$LINENO"; then :
|
slaxemulator@7497
|
443 + ac_cv_c_stack_direction=1
|
slaxemulator@7497
|
444 +else
|
slaxemulator@7497
|
445 + ac_cv_c_stack_direction=-1
|
slaxemulator@7497
|
446 +fi
|
slaxemulator@7497
|
447 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
slaxemulator@7497
|
448 + conftest.$ac_objext conftest.beam conftest.$ac_ext
|
slaxemulator@7497
|
449 +fi
|
slaxemulator@7497
|
450 +
|
slaxemulator@7497
|
451 +fi
|
slaxemulator@7497
|
452 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
|
slaxemulator@7497
|
453 +$as_echo "$ac_cv_c_stack_direction" >&6; }
|
slaxemulator@7497
|
454 +cat >>confdefs.h <<_ACEOF
|
slaxemulator@7497
|
455 +#define STACK_DIRECTION $ac_cv_c_stack_direction
|
slaxemulator@7497
|
456 +_ACEOF
|
slaxemulator@7497
|
457 +
|
slaxemulator@7497
|
458 +
|
slaxemulator@7497
|
459 +fi
|
slaxemulator@7497
|
460 +
|
slaxemulator@7497
|
461 +
|
slaxemulator@7497
|
462
|
slaxemulator@7497
|
463 for ac_header in stdint.h
|
slaxemulator@7497
|
464 do :
|
slaxemulator@7497
|
465 @@ -7564,13 +7756,13 @@
|
slaxemulator@7497
|
466 else
|
slaxemulator@7497
|
467 lt_cv_nm_interface="BSD nm"
|
slaxemulator@7497
|
468 echo "int some_variable = 0;" > conftest.$ac_ext
|
slaxemulator@7497
|
469 - (eval echo "\"\$as_me:7567: $ac_compile\"" >&5)
|
slaxemulator@7497
|
470 + (eval echo "\"\$as_me:7759: $ac_compile\"" >&5)
|
slaxemulator@7497
|
471 (eval "$ac_compile" 2>conftest.err)
|
slaxemulator@7497
|
472 cat conftest.err >&5
|
slaxemulator@7497
|
473 - (eval echo "\"\$as_me:7570: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
slaxemulator@7497
|
474 + (eval echo "\"\$as_me:7762: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
slaxemulator@7497
|
475 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
slaxemulator@7497
|
476 cat conftest.err >&5
|
slaxemulator@7497
|
477 - (eval echo "\"\$as_me:7573: output\"" >&5)
|
slaxemulator@7497
|
478 + (eval echo "\"\$as_me:7765: output\"" >&5)
|
slaxemulator@7497
|
479 cat conftest.out >&5
|
slaxemulator@7497
|
480 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
slaxemulator@7497
|
481 lt_cv_nm_interface="MS dumpbin"
|
slaxemulator@7497
|
482 @@ -8772,7 +8964,7 @@
|
slaxemulator@7497
|
483 ;;
|
slaxemulator@7497
|
484 *-*-irix6*)
|
slaxemulator@7497
|
485 # Find out which ABI we are using.
|
slaxemulator@7497
|
486 - echo '#line 8775 "configure"' > conftest.$ac_ext
|
slaxemulator@7497
|
487 + echo '#line 8967 "configure"' > conftest.$ac_ext
|
slaxemulator@7497
|
488 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
slaxemulator@7497
|
489 (eval $ac_compile) 2>&5
|
slaxemulator@7497
|
490 ac_status=$?
|
slaxemulator@7497
|
491 @@ -10032,11 +10224,11 @@
|
slaxemulator@7497
|
492 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
slaxemulator@7497
|
493 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
slaxemulator@7497
|
494 -e 's:$: $lt_compiler_flag:'`
|
slaxemulator@7497
|
495 - (eval echo "\"\$as_me:10035: $lt_compile\"" >&5)
|
slaxemulator@7497
|
496 + (eval echo "\"\$as_me:10227: $lt_compile\"" >&5)
|
slaxemulator@7497
|
497 (eval "$lt_compile" 2>conftest.err)
|
slaxemulator@7497
|
498 ac_status=$?
|
slaxemulator@7497
|
499 cat conftest.err >&5
|
slaxemulator@7497
|
500 - echo "$as_me:10039: \$? = $ac_status" >&5
|
slaxemulator@7497
|
501 + echo "$as_me:10231: \$? = $ac_status" >&5
|
slaxemulator@7497
|
502 if (exit $ac_status) && test -s "$ac_outfile"; then
|
slaxemulator@7497
|
503 # The compiler can only warn and ignore the option if not recognized
|
slaxemulator@7497
|
504 # So say no if there are warnings other than the usual output.
|
slaxemulator@7497
|
505 @@ -10371,11 +10563,11 @@
|
slaxemulator@7497
|
506 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
slaxemulator@7497
|
507 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
slaxemulator@7497
|
508 -e 's:$: $lt_compiler_flag:'`
|
slaxemulator@7497
|
509 - (eval echo "\"\$as_me:10374: $lt_compile\"" >&5)
|
slaxemulator@7497
|
510 + (eval echo "\"\$as_me:10566: $lt_compile\"" >&5)
|
slaxemulator@7497
|
511 (eval "$lt_compile" 2>conftest.err)
|
slaxemulator@7497
|
512 ac_status=$?
|
slaxemulator@7497
|
513 cat conftest.err >&5
|
slaxemulator@7497
|
514 - echo "$as_me:10378: \$? = $ac_status" >&5
|
slaxemulator@7497
|
515 + echo "$as_me:10570: \$? = $ac_status" >&5
|
slaxemulator@7497
|
516 if (exit $ac_status) && test -s "$ac_outfile"; then
|
slaxemulator@7497
|
517 # The compiler can only warn and ignore the option if not recognized
|
slaxemulator@7497
|
518 # So say no if there are warnings other than the usual output.
|
slaxemulator@7497
|
519 @@ -10476,11 +10668,11 @@
|
slaxemulator@7497
|
520 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
slaxemulator@7497
|
521 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
slaxemulator@7497
|
522 -e 's:$: $lt_compiler_flag:'`
|
slaxemulator@7497
|
523 - (eval echo "\"\$as_me:10479: $lt_compile\"" >&5)
|
slaxemulator@7497
|
524 + (eval echo "\"\$as_me:10671: $lt_compile\"" >&5)
|
slaxemulator@7497
|
525 (eval "$lt_compile" 2>out/conftest.err)
|
slaxemulator@7497
|
526 ac_status=$?
|
slaxemulator@7497
|
527 cat out/conftest.err >&5
|
slaxemulator@7497
|
528 - echo "$as_me:10483: \$? = $ac_status" >&5
|
slaxemulator@7497
|
529 + echo "$as_me:10675: \$? = $ac_status" >&5
|
slaxemulator@7497
|
530 if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
slaxemulator@7497
|
531 then
|
slaxemulator@7497
|
532 # The compiler can only warn and ignore the option if not recognized
|
slaxemulator@7497
|
533 @@ -10531,11 +10723,11 @@
|
slaxemulator@7497
|
534 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
slaxemulator@7497
|
535 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
slaxemulator@7497
|
536 -e 's:$: $lt_compiler_flag:'`
|
slaxemulator@7497
|
537 - (eval echo "\"\$as_me:10534: $lt_compile\"" >&5)
|
slaxemulator@7497
|
538 + (eval echo "\"\$as_me:10726: $lt_compile\"" >&5)
|
slaxemulator@7497
|
539 (eval "$lt_compile" 2>out/conftest.err)
|
slaxemulator@7497
|
540 ac_status=$?
|
slaxemulator@7497
|
541 cat out/conftest.err >&5
|
slaxemulator@7497
|
542 - echo "$as_me:10538: \$? = $ac_status" >&5
|
slaxemulator@7497
|
543 + echo "$as_me:10730: \$? = $ac_status" >&5
|
slaxemulator@7497
|
544 if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
slaxemulator@7497
|
545 then
|
slaxemulator@7497
|
546 # The compiler can only warn and ignore the option if not recognized
|
slaxemulator@7497
|
547 @@ -12915,7 +13107,7 @@
|
slaxemulator@7497
|
548 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
slaxemulator@7497
|
549 lt_status=$lt_dlunknown
|
slaxemulator@7497
|
550 cat > conftest.$ac_ext <<_LT_EOF
|
slaxemulator@7497
|
551 -#line 12918 "configure"
|
slaxemulator@7497
|
552 +#line 13110 "configure"
|
slaxemulator@7497
|
553 #include "confdefs.h"
|
slaxemulator@7497
|
554
|
slaxemulator@7497
|
555 #if HAVE_DLFCN_H
|
slaxemulator@7497
|
556 @@ -13011,7 +13203,7 @@
|
slaxemulator@7497
|
557 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
slaxemulator@7497
|
558 lt_status=$lt_dlunknown
|
slaxemulator@7497
|
559 cat > conftest.$ac_ext <<_LT_EOF
|
slaxemulator@7497
|
560 -#line 13014 "configure"
|
slaxemulator@7497
|
561 +#line 13206 "configure"
|
slaxemulator@7497
|
562 #include "confdefs.h"
|
slaxemulator@7497
|
563
|
slaxemulator@7497
|
564 #if HAVE_DLFCN_H
|
slaxemulator@7497
|
565 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
566 --- mpfr-3.0.0-a/mpfr.h 2010-06-23 11:03:20.000000000 +0000
|
slaxemulator@7497
|
567 +++ mpfr-3.0.0-b/mpfr.h 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
568 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
569 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
570 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
571 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
572 -#define MPFR_VERSION_STRING "3.0.0-p1"
|
slaxemulator@7497
|
573 +#define MPFR_VERSION_STRING "3.0.0-p2"
|
slaxemulator@7497
|
574
|
slaxemulator@7497
|
575 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
576 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
577 diff -Naurd mpfr-3.0.0-a/tests/Makefile.in mpfr-3.0.0-b/tests/Makefile.in
|
slaxemulator@7497
|
578 --- mpfr-3.0.0-a/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
|
slaxemulator@7497
|
579 +++ mpfr-3.0.0-b/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
|
slaxemulator@7497
|
580 @@ -960,6 +960,7 @@
|
slaxemulator@7497
|
581 red=; grn=; lgn=; blu=; std=
|
slaxemulator@7497
|
582 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
slaxemulator@7497
|
583 ACLOCAL = @ACLOCAL@
|
slaxemulator@7497
|
584 +ALLOCA = @ALLOCA@
|
slaxemulator@7497
|
585 AMTAR = @AMTAR@
|
slaxemulator@7497
|
586 AR = @AR@
|
slaxemulator@7497
|
587 AS = @AS@
|
slaxemulator@7497
|
588 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
589 --- mpfr-3.0.0-a/version.c 2010-06-23 11:03:20.000000000 +0000
|
slaxemulator@7497
|
590 +++ mpfr-3.0.0-b/version.c 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
591 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
592 const char *
|
slaxemulator@7497
|
593 mpfr_get_version (void)
|
slaxemulator@7497
|
594 {
|
slaxemulator@7497
|
595 - return "3.0.0-p1";
|
slaxemulator@7497
|
596 + return "3.0.0-p2";
|
slaxemulator@7497
|
597 }
|
slaxemulator@7497
|
598 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
599 --- mpfr-3.0.0-a/PATCHES 2010-07-10 00:11:19.000000000 +0000
|
slaxemulator@7497
|
600 +++ mpfr-3.0.0-b/PATCHES 2010-07-10 00:12:50.000000000 +0000
|
slaxemulator@7497
|
601 @@ -0,0 +1 @@
|
slaxemulator@7497
|
602 +gamma_underflow
|
slaxemulator@7497
|
603 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
604 --- mpfr-3.0.0-a/VERSION 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
605 +++ mpfr-3.0.0-b/VERSION 2010-07-10 00:11:53.000000000 +0000
|
slaxemulator@7497
|
606 @@ -1 +1 @@
|
slaxemulator@7497
|
607 -3.0.0-p2
|
slaxemulator@7497
|
608 +3.0.0-p3
|
slaxemulator@7497
|
609 diff -Naurd mpfr-3.0.0-a/gamma.c mpfr-3.0.0-b/gamma.c
|
slaxemulator@7497
|
610 --- mpfr-3.0.0-a/gamma.c 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
611 +++ mpfr-3.0.0-b/gamma.c 2010-07-10 00:11:46.000000000 +0000
|
slaxemulator@7497
|
612 @@ -274,7 +274,7 @@
|
slaxemulator@7497
|
613 /* we want an upper bound for x * [log(2-x)-1].
|
slaxemulator@7497
|
614 since x < 0, we need a lower bound on log(2-x) */
|
slaxemulator@7497
|
615 mpfr_ui_sub (xp, 2, x, MPFR_RNDD);
|
slaxemulator@7497
|
616 - mpfr_log (xp, xp, MPFR_RNDD);
|
slaxemulator@7497
|
617 + mpfr_log2 (xp, xp, MPFR_RNDD);
|
slaxemulator@7497
|
618 mpfr_sub_ui (xp, xp, 1, MPFR_RNDD);
|
slaxemulator@7497
|
619 mpfr_mul (xp, xp, x, MPFR_RNDU);
|
slaxemulator@7497
|
620
|
slaxemulator@7497
|
621 @@ -303,8 +303,8 @@
|
slaxemulator@7497
|
622 {
|
slaxemulator@7497
|
623 mpfr_sub (tmp, tmp, tmp2, MPFR_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
|
slaxemulator@7497
|
624 mpfr_ui_div (tmp, 12, tmp, MPFR_RNDU); /* upper bound */
|
slaxemulator@7497
|
625 - mpfr_log (tmp, tmp, MPFR_RNDU);
|
slaxemulator@7497
|
626 - mpfr_add (tmp, tmp, xp, MPFR_RNDU);
|
slaxemulator@7497
|
627 + mpfr_log2 (tmp, tmp, MPFR_RNDU);
|
slaxemulator@7497
|
628 + mpfr_add (xp, tmp, xp, MPFR_RNDU);
|
slaxemulator@7497
|
629 underflow = mpfr_cmp_si (xp, expo.saved_emin - 2) <= 0;
|
slaxemulator@7497
|
630 }
|
slaxemulator@7497
|
631
|
slaxemulator@7497
|
632 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
633 --- mpfr-3.0.0-a/mpfr.h 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
634 +++ mpfr-3.0.0-b/mpfr.h 2010-07-10 00:11:53.000000000 +0000
|
slaxemulator@7497
|
635 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
636 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
637 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
638 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
639 -#define MPFR_VERSION_STRING "3.0.0-p2"
|
slaxemulator@7497
|
640 +#define MPFR_VERSION_STRING "3.0.0-p3"
|
slaxemulator@7497
|
641
|
slaxemulator@7497
|
642 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
643 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
644 diff -Naurd mpfr-3.0.0-a/tests/tgamma.c mpfr-3.0.0-b/tests/tgamma.c
|
slaxemulator@7497
|
645 --- mpfr-3.0.0-a/tests/tgamma.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
646 +++ mpfr-3.0.0-b/tests/tgamma.c 2010-07-10 00:11:46.000000000 +0000
|
slaxemulator@7497
|
647 @@ -461,6 +461,20 @@
|
slaxemulator@7497
|
648 mpfr_clear (x);
|
slaxemulator@7497
|
649 }
|
slaxemulator@7497
|
650
|
slaxemulator@7497
|
651 +/* bug found by Stathis, only occurs on 32-bit machines */
|
slaxemulator@7497
|
652 +static void
|
slaxemulator@7497
|
653 +test20100709 (void)
|
slaxemulator@7497
|
654 +{
|
slaxemulator@7497
|
655 + mpfr_t x;
|
slaxemulator@7497
|
656 + int inex;
|
slaxemulator@7497
|
657 +
|
slaxemulator@7497
|
658 + mpfr_init2 (x, 100);
|
slaxemulator@7497
|
659 + mpfr_set_str (x, "-4.6308260837372266e+07", 10, MPFR_RNDN);
|
slaxemulator@7497
|
660 + inex = mpfr_gamma (x, x, MPFR_RNDN);
|
slaxemulator@7497
|
661 + MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_NEG(x) && inex > 0);
|
slaxemulator@7497
|
662 + mpfr_clear (x);
|
slaxemulator@7497
|
663 +}
|
slaxemulator@7497
|
664 +
|
slaxemulator@7497
|
665 int
|
slaxemulator@7497
|
666 main (int argc, char *argv[])
|
slaxemulator@7497
|
667 {
|
slaxemulator@7497
|
668 @@ -471,6 +485,7 @@
|
slaxemulator@7497
|
669 test_generic (2, 100, 2);
|
slaxemulator@7497
|
670 gamma_integer ();
|
slaxemulator@7497
|
671 test20071231 ();
|
slaxemulator@7497
|
672 + test20100709 ();
|
slaxemulator@7497
|
673
|
slaxemulator@7497
|
674 data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
|
slaxemulator@7497
|
675
|
slaxemulator@7497
|
676 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
677 --- mpfr-3.0.0-a/version.c 2010-06-25 13:23:13.000000000 +0000
|
slaxemulator@7497
|
678 +++ mpfr-3.0.0-b/version.c 2010-07-10 00:11:53.000000000 +0000
|
slaxemulator@7497
|
679 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
680 const char *
|
slaxemulator@7497
|
681 mpfr_get_version (void)
|
slaxemulator@7497
|
682 {
|
slaxemulator@7497
|
683 - return "3.0.0-p2";
|
slaxemulator@7497
|
684 + return "3.0.0-p3";
|
slaxemulator@7497
|
685 }
|
slaxemulator@7497
|
686 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
687 --- mpfr-3.0.0-a/PATCHES 2010-09-07 08:44:01.000000000 +0000
|
slaxemulator@7497
|
688 +++ mpfr-3.0.0-b/PATCHES 2010-09-07 08:48:46.000000000 +0000
|
slaxemulator@7497
|
689 @@ -0,0 +1 @@
|
slaxemulator@7497
|
690 +mpfr_cmp/set_ui/si
|
slaxemulator@7497
|
691 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
692 --- mpfr-3.0.0-a/VERSION 2010-07-10 00:11:53.000000000 +0000
|
slaxemulator@7497
|
693 +++ mpfr-3.0.0-b/VERSION 2010-09-07 08:46:06.000000000 +0000
|
slaxemulator@7497
|
694 @@ -1 +1 @@
|
slaxemulator@7497
|
695 -3.0.0-p3
|
slaxemulator@7497
|
696 +3.0.0-p4
|
slaxemulator@7497
|
697 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
698 --- mpfr-3.0.0-a/mpfr.h 2010-07-10 00:11:53.000000000 +0000
|
slaxemulator@7497
|
699 +++ mpfr-3.0.0-b/mpfr.h 2010-09-07 08:46:06.000000000 +0000
|
slaxemulator@7497
|
700 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
701 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
702 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
703 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
704 -#define MPFR_VERSION_STRING "3.0.0-p3"
|
slaxemulator@7497
|
705 +#define MPFR_VERSION_STRING "3.0.0-p4"
|
slaxemulator@7497
|
706
|
slaxemulator@7497
|
707 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
708 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
709 @@ -798,35 +798,45 @@
|
slaxemulator@7497
|
710 anyway. Checking with other ICC versions is needed. Possibly detect
|
slaxemulator@7497
|
711 whether warnings are produced or not with a configure test.
|
slaxemulator@7497
|
712 + Remove C++ too, since it complains too much. */
|
slaxemulator@7497
|
713 +/* Added casts to improve robustness in case of undefined behavior and
|
slaxemulator@7497
|
714 + compiler extensions based on UB (in particular -fwrapv). MPFR doesn't
|
slaxemulator@7497
|
715 + use such extensions, but these macros will be used by 3rd-party code,
|
slaxemulator@7497
|
716 + where such extensions may be required.
|
slaxemulator@7497
|
717 + Moreover casts to unsigned long have been added to avoid warnings in
|
slaxemulator@7497
|
718 + programs that use MPFR and are compiled with -Wconversion; such casts
|
slaxemulator@7497
|
719 + are OK since if X is a constant expression, then (unsigned long) X is
|
slaxemulator@7497
|
720 + also a constant expression, so that the optimizations still work. */
|
slaxemulator@7497
|
721 #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
|
slaxemulator@7497
|
722 #if (__GNUC__ >= 2)
|
slaxemulator@7497
|
723 #undef mpfr_cmp_ui
|
slaxemulator@7497
|
724 -/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. */
|
slaxemulator@7497
|
725 -#define mpfr_cmp_ui(_f,_u) \
|
slaxemulator@7497
|
726 - (__builtin_constant_p (_u) && (_u) == 0 ? \
|
slaxemulator@7497
|
727 - mpfr_sgn (_f) : \
|
slaxemulator@7497
|
728 - mpfr_cmp_ui_2exp ((_f),(_u),0))
|
slaxemulator@7497
|
729 +/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
|
slaxemulator@7497
|
730 + But warning! mpfr_sgn is specified as a macro in the API, thus the macro
|
slaxemulator@7497
|
731 + mustn't be used if side effects are possible, like here. */
|
slaxemulator@7497
|
732 +#define mpfr_cmp_ui(_f,_u) \
|
slaxemulator@7497
|
733 + (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
|
slaxemulator@7497
|
734 + (mpfr_sgn) (_f) : \
|
slaxemulator@7497
|
735 + mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
|
slaxemulator@7497
|
736 #undef mpfr_cmp_si
|
slaxemulator@7497
|
737 -#define mpfr_cmp_si(_f,_s) \
|
slaxemulator@7497
|
738 - (__builtin_constant_p (_s) && (_s) >= 0 ? \
|
slaxemulator@7497
|
739 - mpfr_cmp_ui ((_f), (_s)) : \
|
slaxemulator@7497
|
740 - mpfr_cmp_si_2exp ((_f), (_s), 0))
|
slaxemulator@7497
|
741 +#define mpfr_cmp_si(_f,_s) \
|
slaxemulator@7497
|
742 + (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
|
slaxemulator@7497
|
743 + mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
|
slaxemulator@7497
|
744 + mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
|
slaxemulator@7497
|
745 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
|
slaxemulator@7497
|
746 #undef mpfr_set_ui
|
slaxemulator@7497
|
747 -#define mpfr_set_ui(_f,_u,_r) \
|
slaxemulator@7497
|
748 - (__builtin_constant_p (_u) && (_u) == 0 ? \
|
slaxemulator@7497
|
749 - __extension__ ({ \
|
slaxemulator@7497
|
750 - mpfr_ptr _p = (_f); \
|
slaxemulator@7497
|
751 - _p->_mpfr_sign = 1; \
|
slaxemulator@7497
|
752 - _p->_mpfr_exp = __MPFR_EXP_ZERO; \
|
slaxemulator@7497
|
753 - (void) (_r); 0; }) : \
|
slaxemulator@7497
|
754 - mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
|
slaxemulator@7497
|
755 +#define mpfr_set_ui(_f,_u,_r) \
|
slaxemulator@7497
|
756 + (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
|
slaxemulator@7497
|
757 + __extension__ ({ \
|
slaxemulator@7497
|
758 + mpfr_ptr _p = (_f); \
|
slaxemulator@7497
|
759 + _p->_mpfr_sign = 1; \
|
slaxemulator@7497
|
760 + _p->_mpfr_exp = __MPFR_EXP_ZERO; \
|
slaxemulator@7497
|
761 + (void) (_r); 0; }) : \
|
slaxemulator@7497
|
762 + mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
|
slaxemulator@7497
|
763 #endif
|
slaxemulator@7497
|
764 #undef mpfr_set_si
|
slaxemulator@7497
|
765 -#define mpfr_set_si(_f,_s,_r) \
|
slaxemulator@7497
|
766 - (__builtin_constant_p (_s) && (_s) >= 0 ? \
|
slaxemulator@7497
|
767 - mpfr_set_ui ((_f), (_s), (_r)) : \
|
slaxemulator@7497
|
768 - mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
|
slaxemulator@7497
|
769 +#define mpfr_set_si(_f,_s,_r) \
|
slaxemulator@7497
|
770 + (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
|
slaxemulator@7497
|
771 + mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
|
slaxemulator@7497
|
772 + mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
|
slaxemulator@7497
|
773 #endif
|
slaxemulator@7497
|
774 #endif
|
slaxemulator@7497
|
775
|
slaxemulator@7497
|
776 diff -Naurd mpfr-3.0.0-a/tests/tcmp_ui.c mpfr-3.0.0-b/tests/tcmp_ui.c
|
slaxemulator@7497
|
777 --- mpfr-3.0.0-a/tests/tcmp_ui.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
778 +++ mpfr-3.0.0-b/tests/tcmp_ui.c 2010-09-07 08:45:12.000000000 +0000
|
slaxemulator@7497
|
779 @@ -88,6 +88,126 @@
|
slaxemulator@7497
|
780 mpfr_clear (x);
|
slaxemulator@7497
|
781 }
|
slaxemulator@7497
|
782
|
slaxemulator@7497
|
783 +/* Since mpfr_cmp_ui and mpfr_cmp_si are also implemented by a macro
|
slaxemulator@7497
|
784 + with __builtin_constant_p for GCC, check that side effects are
|
slaxemulator@7497
|
785 + handled correctly. */
|
slaxemulator@7497
|
786 +static void
|
slaxemulator@7497
|
787 +check_macros (void)
|
slaxemulator@7497
|
788 +{
|
slaxemulator@7497
|
789 + mpfr_t x;
|
slaxemulator@7497
|
790 + int c;
|
slaxemulator@7497
|
791 +
|
slaxemulator@7497
|
792 + mpfr_init2 (x, 32);
|
slaxemulator@7497
|
793 +
|
slaxemulator@7497
|
794 + c = 0;
|
slaxemulator@7497
|
795 + mpfr_set_ui (x, 17, MPFR_RNDN);
|
slaxemulator@7497
|
796 + if (mpfr_cmp_ui (x, 17) != 0)
|
slaxemulator@7497
|
797 + {
|
slaxemulator@7497
|
798 + printf ("Error 1 on mpfr_cmp_ui(x,17) in check_macros\n");
|
slaxemulator@7497
|
799 + exit (1);
|
slaxemulator@7497
|
800 + }
|
slaxemulator@7497
|
801 + if (mpfr_cmp_ui (x, (c++, 17)) != 0)
|
slaxemulator@7497
|
802 + {
|
slaxemulator@7497
|
803 + printf ("Error 2 on mpfr_cmp_ui(x,17) in check_macros\n");
|
slaxemulator@7497
|
804 + exit (1);
|
slaxemulator@7497
|
805 + }
|
slaxemulator@7497
|
806 + if (c != 1)
|
slaxemulator@7497
|
807 + {
|
slaxemulator@7497
|
808 + printf ("Error 3 on mpfr_cmp_ui(x,17) in check_macros\n"
|
slaxemulator@7497
|
809 + "(c = %d instead of 1)\n", c);
|
slaxemulator@7497
|
810 + exit (1);
|
slaxemulator@7497
|
811 + }
|
slaxemulator@7497
|
812 + if (mpfr_cmp_si (x, 17) != 0)
|
slaxemulator@7497
|
813 + {
|
slaxemulator@7497
|
814 + printf ("Error 1 on mpfr_cmp_si(x,17) in check_macros\n");
|
slaxemulator@7497
|
815 + exit (1);
|
slaxemulator@7497
|
816 + }
|
slaxemulator@7497
|
817 + if (mpfr_cmp_si (x, (c++, 17)) != 0)
|
slaxemulator@7497
|
818 + {
|
slaxemulator@7497
|
819 + printf ("Error 2 on mpfr_cmp_si(x,17) in check_macros\n");
|
slaxemulator@7497
|
820 + exit (1);
|
slaxemulator@7497
|
821 + }
|
slaxemulator@7497
|
822 + if (c != 2)
|
slaxemulator@7497
|
823 + {
|
slaxemulator@7497
|
824 + printf ("Error 3 on mpfr_cmp_si(x,17) in check_macros\n"
|
slaxemulator@7497
|
825 + "(c = %d instead of 2)\n", c);
|
slaxemulator@7497
|
826 + exit (1);
|
slaxemulator@7497
|
827 + }
|
slaxemulator@7497
|
828 +
|
slaxemulator@7497
|
829 + c = 0;
|
slaxemulator@7497
|
830 + mpfr_set_ui (x, 0, MPFR_RNDN);
|
slaxemulator@7497
|
831 + if (mpfr_cmp_ui (x, 0) != 0)
|
slaxemulator@7497
|
832 + {
|
slaxemulator@7497
|
833 + printf ("Error 1 on mpfr_cmp_ui(x,0) in check_macros\n");
|
slaxemulator@7497
|
834 + exit (1);
|
slaxemulator@7497
|
835 + }
|
slaxemulator@7497
|
836 + if (mpfr_cmp_ui (x, (c++, 0)) != 0)
|
slaxemulator@7497
|
837 + {
|
slaxemulator@7497
|
838 + printf ("Error 2 on mpfr_cmp_ui(x,0) in check_macros\n");
|
slaxemulator@7497
|
839 + exit (1);
|
slaxemulator@7497
|
840 + }
|
slaxemulator@7497
|
841 + if (c != 1)
|
slaxemulator@7497
|
842 + {
|
slaxemulator@7497
|
843 + printf ("Error 3 on mpfr_cmp_ui(x,0) in check_macros\n"
|
slaxemulator@7497
|
844 + "(c = %d instead of 1)\n", c);
|
slaxemulator@7497
|
845 + exit (1);
|
slaxemulator@7497
|
846 + }
|
slaxemulator@7497
|
847 + if (mpfr_cmp_si (x, 0) != 0)
|
slaxemulator@7497
|
848 + {
|
slaxemulator@7497
|
849 + printf ("Error 1 on mpfr_cmp_si(x,0) in check_macros\n");
|
slaxemulator@7497
|
850 + exit (1);
|
slaxemulator@7497
|
851 + }
|
slaxemulator@7497
|
852 + if (mpfr_cmp_si (x, (c++, 0)) != 0)
|
slaxemulator@7497
|
853 + {
|
slaxemulator@7497
|
854 + printf ("Error 2 on mpfr_cmp_si(x,0) in check_macros\n");
|
slaxemulator@7497
|
855 + exit (1);
|
slaxemulator@7497
|
856 + }
|
slaxemulator@7497
|
857 + if (c != 2)
|
slaxemulator@7497
|
858 + {
|
slaxemulator@7497
|
859 + printf ("Error 3 on mpfr_cmp_si(x,0) in check_macros\n"
|
slaxemulator@7497
|
860 + "(c = %d instead of 2)\n", c);
|
slaxemulator@7497
|
861 + exit (1);
|
slaxemulator@7497
|
862 + }
|
slaxemulator@7497
|
863 +
|
slaxemulator@7497
|
864 + mpfr_clear (x);
|
slaxemulator@7497
|
865 +}
|
slaxemulator@7497
|
866 +
|
slaxemulator@7497
|
867 +/* Bug in r7114 */
|
slaxemulator@7497
|
868 +static void
|
slaxemulator@7497
|
869 +test_macros (void)
|
slaxemulator@7497
|
870 +{
|
slaxemulator@7497
|
871 + mpfr_t x[3];
|
slaxemulator@7497
|
872 + mpfr_ptr p;
|
slaxemulator@7497
|
873 +
|
slaxemulator@7497
|
874 + mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
|
slaxemulator@7497
|
875 + mpfr_set_ui (x[0], 0, MPFR_RNDN);
|
slaxemulator@7497
|
876 + p = x[0];
|
slaxemulator@7497
|
877 + if (mpfr_cmp_ui (p++, 0) != 0)
|
slaxemulator@7497
|
878 + {
|
slaxemulator@7497
|
879 + printf ("Error in mpfr_cmp_ui macro: result should be 0.\n");
|
slaxemulator@7497
|
880 + exit (1);
|
slaxemulator@7497
|
881 + }
|
slaxemulator@7497
|
882 + if (p != x[1])
|
slaxemulator@7497
|
883 + {
|
slaxemulator@7497
|
884 + printf ("Error in mpfr_cmp_ui macro: p - x[0] = %d (expecting 1)\n",
|
slaxemulator@7497
|
885 + (int) (p - x[0]));
|
slaxemulator@7497
|
886 + exit (1);
|
slaxemulator@7497
|
887 + }
|
slaxemulator@7497
|
888 + p = x[0];
|
slaxemulator@7497
|
889 + if (mpfr_cmp_si (p++, 0) != 0)
|
slaxemulator@7497
|
890 + {
|
slaxemulator@7497
|
891 + printf ("Error in mpfr_cmp_si macro: result should be 0.\n");
|
slaxemulator@7497
|
892 + exit (1);
|
slaxemulator@7497
|
893 + }
|
slaxemulator@7497
|
894 + if (p != x[1])
|
slaxemulator@7497
|
895 + {
|
slaxemulator@7497
|
896 + printf ("Error in mpfr_cmp_si macro: p - x[0] = %d (expecting 1)\n",
|
slaxemulator@7497
|
897 + (int) (p - x[0]));
|
slaxemulator@7497
|
898 + exit (1);
|
slaxemulator@7497
|
899 + }
|
slaxemulator@7497
|
900 + mpfr_clears (x[0], x[1], x[2], (mpfr_ptr) 0);
|
slaxemulator@7497
|
901 +}
|
slaxemulator@7497
|
902 +
|
slaxemulator@7497
|
903 int
|
slaxemulator@7497
|
904 main (void)
|
slaxemulator@7497
|
905 {
|
slaxemulator@7497
|
906 @@ -216,6 +336,8 @@
|
slaxemulator@7497
|
907 mpfr_clear (x);
|
slaxemulator@7497
|
908
|
slaxemulator@7497
|
909 check_nan ();
|
slaxemulator@7497
|
910 + check_macros ();
|
slaxemulator@7497
|
911 + test_macros ();
|
slaxemulator@7497
|
912
|
slaxemulator@7497
|
913 tests_end_mpfr ();
|
slaxemulator@7497
|
914 return 0;
|
slaxemulator@7497
|
915 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
916 --- mpfr-3.0.0-a/version.c 2010-07-10 00:11:53.000000000 +0000
|
slaxemulator@7497
|
917 +++ mpfr-3.0.0-b/version.c 2010-09-07 08:46:06.000000000 +0000
|
slaxemulator@7497
|
918 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
919 const char *
|
slaxemulator@7497
|
920 mpfr_get_version (void)
|
slaxemulator@7497
|
921 {
|
slaxemulator@7497
|
922 - return "3.0.0-p3";
|
slaxemulator@7497
|
923 + return "3.0.0-p4";
|
slaxemulator@7497
|
924 }
|
slaxemulator@7497
|
925 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
926 --- mpfr-3.0.0-a/PATCHES 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
927 +++ mpfr-3.0.0-b/PATCHES 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
928 @@ -0,0 +1 @@
|
slaxemulator@7497
|
929 +tcan_round
|
slaxemulator@7497
|
930 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
931 --- mpfr-3.0.0-a/VERSION 2010-09-07 08:46:06.000000000 +0000
|
slaxemulator@7497
|
932 +++ mpfr-3.0.0-b/VERSION 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
933 @@ -1 +1 @@
|
slaxemulator@7497
|
934 -3.0.0-p4
|
slaxemulator@7497
|
935 +3.0.0-p5
|
slaxemulator@7497
|
936 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
937 --- mpfr-3.0.0-a/mpfr.h 2010-09-07 08:46:06.000000000 +0000
|
slaxemulator@7497
|
938 +++ mpfr-3.0.0-b/mpfr.h 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
939 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
940 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
941 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
942 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
943 -#define MPFR_VERSION_STRING "3.0.0-p4"
|
slaxemulator@7497
|
944 +#define MPFR_VERSION_STRING "3.0.0-p5"
|
slaxemulator@7497
|
945
|
slaxemulator@7497
|
946 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
947 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
948 diff -Naurd mpfr-3.0.0-a/tests/tcan_round.c mpfr-3.0.0-b/tests/tcan_round.c
|
slaxemulator@7497
|
949 --- mpfr-3.0.0-a/tests/tcan_round.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
950 +++ mpfr-3.0.0-b/tests/tcan_round.c 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
951 @@ -41,7 +41,7 @@
|
slaxemulator@7497
|
952 /* avoid mpn_random which leaks memory */
|
slaxemulator@7497
|
953 for (i = 0; i < n; i++)
|
slaxemulator@7497
|
954 buf[i] = randlimb ();
|
slaxemulator@7497
|
955 - p = (mpfr_prec_t) randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
|
slaxemulator@7497
|
956 + p = randlimb() % ((n-1) * GMP_NUMB_BITS) + MPFR_PREC_MIN;
|
slaxemulator@7497
|
957 err = p + randlimb () % GMP_NUMB_BITS;
|
slaxemulator@7497
|
958 r1 = mpfr_round_p (buf, n, err, p);
|
slaxemulator@7497
|
959 r2 = mpfr_can_round_raw (buf, n, MPFR_SIGN_POS, err,
|
slaxemulator@7497
|
960 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
961 --- mpfr-3.0.0-a/version.c 2010-09-07 08:46:06.000000000 +0000
|
slaxemulator@7497
|
962 +++ mpfr-3.0.0-b/version.c 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
963 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
964 const char *
|
slaxemulator@7497
|
965 mpfr_get_version (void)
|
slaxemulator@7497
|
966 {
|
slaxemulator@7497
|
967 - return "3.0.0-p4";
|
slaxemulator@7497
|
968 + return "3.0.0-p5";
|
slaxemulator@7497
|
969 }
|
slaxemulator@7497
|
970 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
971 --- mpfr-3.0.0-a/PATCHES 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
972 +++ mpfr-3.0.0-b/PATCHES 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
973 @@ -0,0 +1 @@
|
slaxemulator@7497
|
974 +mpfr_sub1
|
slaxemulator@7497
|
975 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
976 --- mpfr-3.0.0-a/VERSION 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
977 +++ mpfr-3.0.0-b/VERSION 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
978 @@ -1 +1 @@
|
slaxemulator@7497
|
979 -3.0.0-p5
|
slaxemulator@7497
|
980 +3.0.0-p6
|
slaxemulator@7497
|
981 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
982 --- mpfr-3.0.0-a/mpfr.h 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
983 +++ mpfr-3.0.0-b/mpfr.h 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
984 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
985 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
986 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
987 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
988 -#define MPFR_VERSION_STRING "3.0.0-p5"
|
slaxemulator@7497
|
989 +#define MPFR_VERSION_STRING "3.0.0-p6"
|
slaxemulator@7497
|
990
|
slaxemulator@7497
|
991 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
992 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
993 diff -Naurd mpfr-3.0.0-a/sub1.c mpfr-3.0.0-b/sub1.c
|
slaxemulator@7497
|
994 --- mpfr-3.0.0-a/sub1.c 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
995 +++ mpfr-3.0.0-b/sub1.c 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
996 @@ -37,7 +37,9 @@
|
slaxemulator@7497
|
997 mp_size_t cancel2, an, bn, cn, cn0;
|
slaxemulator@7497
|
998 mp_limb_t *ap, *bp, *cp;
|
slaxemulator@7497
|
999 mp_limb_t carry, bb, cc, borrow = 0;
|
slaxemulator@7497
|
1000 - int inexact, shift_b, shift_c, is_exact = 1, down = 0, add_exp = 0;
|
slaxemulator@7497
|
1001 + int inexact, shift_b, shift_c, add_exp = 0;
|
slaxemulator@7497
|
1002 + int cmp_low = 0; /* used for rounding to nearest: 0 if low(b) = low(c),
|
slaxemulator@7497
|
1003 + negative if low(b) < low(c), positive if low(b)>low(c) */
|
slaxemulator@7497
|
1004 int sh, k;
|
slaxemulator@7497
|
1005 MPFR_TMP_DECL(marker);
|
slaxemulator@7497
|
1006
|
slaxemulator@7497
|
1007 @@ -196,7 +198,8 @@
|
slaxemulator@7497
|
1008 }
|
slaxemulator@7497
|
1009
|
slaxemulator@7497
|
1010 #ifdef DEBUG
|
slaxemulator@7497
|
1011 - printf ("shift_b=%d shift_c=%d diffexp=%lu\n", shift_b, shift_c,
|
slaxemulator@7497
|
1012 + printf ("rnd=%s shift_b=%d shift_c=%d diffexp=%lu\n",
|
slaxemulator@7497
|
1013 + mpfr_print_rnd_mode (rnd_mode), shift_b, shift_c,
|
slaxemulator@7497
|
1014 (unsigned long) diff_exp);
|
slaxemulator@7497
|
1015 #endif
|
slaxemulator@7497
|
1016
|
slaxemulator@7497
|
1017 @@ -307,17 +310,18 @@
|
slaxemulator@7497
|
1018 {
|
slaxemulator@7497
|
1019 if (MPFR_LIKELY(sh))
|
slaxemulator@7497
|
1020 {
|
slaxemulator@7497
|
1021 - is_exact = (carry == 0);
|
slaxemulator@7497
|
1022 /* can decide except when carry = 2^(sh-1) [middle]
|
slaxemulator@7497
|
1023 or carry = 0 [truncate, but cannot decide inexact flag] */
|
slaxemulator@7497
|
1024 - down = (carry < (MPFR_LIMB_ONE << (sh - 1)));
|
slaxemulator@7497
|
1025 if (carry > (MPFR_LIMB_ONE << (sh - 1)))
|
slaxemulator@7497
|
1026 goto add_one_ulp;
|
slaxemulator@7497
|
1027 - else if ((0 < carry) && down)
|
slaxemulator@7497
|
1028 + else if ((0 < carry) && (carry < (MPFR_LIMB_ONE << (sh - 1))))
|
slaxemulator@7497
|
1029 {
|
slaxemulator@7497
|
1030 inexact = -1; /* result if smaller than exact value */
|
slaxemulator@7497
|
1031 goto truncate;
|
slaxemulator@7497
|
1032 }
|
slaxemulator@7497
|
1033 + /* now carry = 2^(sh-1), in which case cmp_low=2,
|
slaxemulator@7497
|
1034 + or carry = 0, in which case cmp_low=0 */
|
slaxemulator@7497
|
1035 + cmp_low = (carry == 0) ? 0 : 2;
|
slaxemulator@7497
|
1036 }
|
slaxemulator@7497
|
1037 }
|
slaxemulator@7497
|
1038 else /* directed rounding: set rnd_mode to RNDZ iff toward zero */
|
slaxemulator@7497
|
1039 @@ -344,12 +348,32 @@
|
slaxemulator@7497
|
1040 cn -= (long int) an + cancel2;
|
slaxemulator@7497
|
1041
|
slaxemulator@7497
|
1042 #ifdef DEBUG
|
slaxemulator@7497
|
1043 - printf ("last %d bits from a are %lu, bn=%ld, cn=%ld\n",
|
slaxemulator@7497
|
1044 + printf ("last sh=%d bits from a are %lu, bn=%ld, cn=%ld\n",
|
slaxemulator@7497
|
1045 sh, (unsigned long) carry, (long) bn, (long) cn);
|
slaxemulator@7497
|
1046 #endif
|
slaxemulator@7497
|
1047
|
slaxemulator@7497
|
1048 + /* for rounding to nearest, we couldn't conclude up to here in the following
|
slaxemulator@7497
|
1049 + cases:
|
slaxemulator@7497
|
1050 + 1. sh = 0, then cmp_low=0: we can either truncate, subtract one ulp
|
slaxemulator@7497
|
1051 + or add one ulp: -1 ulp < low(b)-low(c) < 1 ulp
|
slaxemulator@7497
|
1052 + 2. sh > 0 but the low sh bits from high(b)-high(c) equal 2^(sh-1):
|
slaxemulator@7497
|
1053 + -0.5 ulp <= -1/2^sh < low(b)-low(c)-0.5 < 1/2^sh <= 0.5 ulp
|
slaxemulator@7497
|
1054 + we can't decide the rounding, in that case cmp_low=2:
|
slaxemulator@7497
|
1055 + either we truncate and flag=-1, or we add one ulp and flag=1
|
slaxemulator@7497
|
1056 + 3. the low sh>0 bits from high(b)-high(c) equal 0: we know we have to
|
slaxemulator@7497
|
1057 + truncate but we can't decide the ternary value, here cmp_low=0:
|
slaxemulator@7497
|
1058 + -0.5 ulp <= -1/2^sh < low(b)-low(c) < 1/2^sh <= 0.5 ulp
|
slaxemulator@7497
|
1059 + we always truncate and inexact can be any of -1,0,1
|
slaxemulator@7497
|
1060 + */
|
slaxemulator@7497
|
1061 +
|
slaxemulator@7497
|
1062 + /* note: here cn might exceed cn0, in which case we consider a zero limb */
|
slaxemulator@7497
|
1063 for (k = 0; (bn > 0) || (cn > 0); k = 1)
|
slaxemulator@7497
|
1064 {
|
slaxemulator@7497
|
1065 + /* if cmp_low < 0, we know low(b) - low(c) < 0
|
slaxemulator@7497
|
1066 + if cmp_low > 0, we know low(b) - low(c) > 0
|
slaxemulator@7497
|
1067 + (more precisely if cmp_low = 2, low(b) - low(c) = 0.5 ulp so far)
|
slaxemulator@7497
|
1068 + if cmp_low = 0, so far low(b) - low(c) = 0 */
|
slaxemulator@7497
|
1069 +
|
slaxemulator@7497
|
1070 /* get next limbs */
|
slaxemulator@7497
|
1071 bb = (bn > 0) ? bp[--bn] : 0;
|
slaxemulator@7497
|
1072 if ((cn > 0) && (cn-- <= cn0))
|
slaxemulator@7497
|
1073 @@ -357,76 +381,115 @@
|
slaxemulator@7497
|
1074 else
|
slaxemulator@7497
|
1075 cc = 0;
|
slaxemulator@7497
|
1076
|
slaxemulator@7497
|
1077 - /* down is set when low(b) < low(c) */
|
slaxemulator@7497
|
1078 - if (down == 0)
|
slaxemulator@7497
|
1079 - down = (bb < cc);
|
slaxemulator@7497
|
1080 + /* cmp_low compares low(b) and low(c) */
|
slaxemulator@7497
|
1081 + if (cmp_low == 0) /* case 1 or 3 */
|
slaxemulator@7497
|
1082 + cmp_low = (bb < cc) ? -2+k : (bb > cc) ? 1 : 0;
|
slaxemulator@7497
|
1083 +
|
slaxemulator@7497
|
1084 + /* Case 1 for k=0 splits into 7 subcases:
|
slaxemulator@7497
|
1085 + 1a: bb > cc + half
|
slaxemulator@7497
|
1086 + 1b: bb = cc + half
|
slaxemulator@7497
|
1087 + 1c: 0 < bb - cc < half
|
slaxemulator@7497
|
1088 + 1d: bb = cc
|
slaxemulator@7497
|
1089 + 1e: -half < bb - cc < 0
|
slaxemulator@7497
|
1090 + 1f: bb - cc = -half
|
slaxemulator@7497
|
1091 + 1g: bb - cc < -half
|
slaxemulator@7497
|
1092 +
|
slaxemulator@7497
|
1093 + Case 2 splits into 3 subcases:
|
slaxemulator@7497
|
1094 + 2a: bb > cc
|
slaxemulator@7497
|
1095 + 2b: bb = cc
|
slaxemulator@7497
|
1096 + 2c: bb < cc
|
slaxemulator@7497
|
1097 +
|
slaxemulator@7497
|
1098 + Case 3 splits into 3 subcases:
|
slaxemulator@7497
|
1099 + 3a: bb > cc
|
slaxemulator@7497
|
1100 + 3b: bb = cc
|
slaxemulator@7497
|
1101 + 3c: bb < cc
|
slaxemulator@7497
|
1102 + */
|
slaxemulator@7497
|
1103
|
slaxemulator@7497
|
1104 /* the case rounding to nearest with sh=0 is special since one couldn't
|
slaxemulator@7497
|
1105 subtract above 1/2 ulp in the trailing limb of the result */
|
slaxemulator@7497
|
1106 - if ((rnd_mode == MPFR_RNDN) && sh == 0 && k == 0)
|
slaxemulator@7497
|
1107 + if (rnd_mode == MPFR_RNDN && sh == 0 && k == 0) /* case 1 for k=0 */
|
slaxemulator@7497
|
1108 {
|
slaxemulator@7497
|
1109 mp_limb_t half = MPFR_LIMB_HIGHBIT;
|
slaxemulator@7497
|
1110
|
slaxemulator@7497
|
1111 - is_exact = (bb == cc);
|
slaxemulator@7497
|
1112 -
|
slaxemulator@7497
|
1113 /* add one ulp if bb > cc + half
|
slaxemulator@7497
|
1114 truncate if cc - half < bb < cc + half
|
slaxemulator@7497
|
1115 sub one ulp if bb < cc - half
|
slaxemulator@7497
|
1116 */
|
slaxemulator@7497
|
1117
|
slaxemulator@7497
|
1118 - if (down)
|
slaxemulator@7497
|
1119 + if (cmp_low < 0) /* bb < cc: -1 ulp < low(b) - low(c) < 0,
|
slaxemulator@7497
|
1120 + cases 1e, 1f and 1g */
|
slaxemulator@7497
|
1121 {
|
slaxemulator@7497
|
1122 if (cc >= half)
|
slaxemulator@7497
|
1123 cc -= half;
|
slaxemulator@7497
|
1124 - else
|
slaxemulator@7497
|
1125 + else /* since bb < cc < half, bb+half < 2*half */
|
slaxemulator@7497
|
1126 bb += half;
|
slaxemulator@7497
|
1127 + /* now we have bb < cc + half:
|
slaxemulator@7497
|
1128 + we have to subtract one ulp if bb < cc,
|
slaxemulator@7497
|
1129 + and truncate if bb > cc */
|
slaxemulator@7497
|
1130 }
|
slaxemulator@7497
|
1131 - else /* bb >= cc */
|
slaxemulator@7497
|
1132 + else if (cmp_low >= 0) /* bb >= cc, cases 1a to 1d */
|
slaxemulator@7497
|
1133 {
|
slaxemulator@7497
|
1134 if (cc < half)
|
slaxemulator@7497
|
1135 cc += half;
|
slaxemulator@7497
|
1136 - else
|
slaxemulator@7497
|
1137 + else /* since bb >= cc >= half, bb - half >= 0 */
|
slaxemulator@7497
|
1138 bb -= half;
|
slaxemulator@7497
|
1139 + /* now we have bb > cc - half: we have to add one ulp if bb > cc,
|
slaxemulator@7497
|
1140 + and truncate if bb < cc */
|
slaxemulator@7497
|
1141 + if (cmp_low > 0)
|
slaxemulator@7497
|
1142 + cmp_low = 2;
|
slaxemulator@7497
|
1143 }
|
slaxemulator@7497
|
1144 }
|
slaxemulator@7497
|
1145
|
slaxemulator@7497
|
1146 #ifdef DEBUG
|
slaxemulator@7497
|
1147 - printf (" bb=%lu cc=%lu down=%d is_exact=%d\n",
|
slaxemulator@7497
|
1148 - (unsigned long) bb, (unsigned long) cc, down, is_exact);
|
slaxemulator@7497
|
1149 + printf ("k=%u bb=%lu cc=%lu cmp_low=%d\n", k,
|
slaxemulator@7497
|
1150 + (unsigned long) bb, (unsigned long) cc, cmp_low);
|
slaxemulator@7497
|
1151 #endif
|
slaxemulator@7497
|
1152 - if (bb < cc)
|
slaxemulator@7497
|
1153 + if (cmp_low < 0) /* low(b) - low(c) < 0: either truncate or subtract
|
slaxemulator@7497
|
1154 + one ulp */
|
slaxemulator@7497
|
1155 {
|
slaxemulator@7497
|
1156 if (rnd_mode == MPFR_RNDZ)
|
slaxemulator@7497
|
1157 - goto sub_one_ulp;
|
slaxemulator@7497
|
1158 + goto sub_one_ulp; /* set inexact=-1 */
|
slaxemulator@7497
|
1159 else if (rnd_mode != MPFR_RNDN) /* round away */
|
slaxemulator@7497
|
1160 {
|
slaxemulator@7497
|
1161 inexact = 1;
|
slaxemulator@7497
|
1162 goto truncate;
|
slaxemulator@7497
|
1163 }
|
slaxemulator@7497
|
1164 - else /* round to nearest: special case here since for sh=k=0
|
slaxemulator@7497
|
1165 - bb = bb0 - MPFR_LIMB_HIGHBIT */
|
slaxemulator@7497
|
1166 + else /* round to nearest */
|
slaxemulator@7497
|
1167 {
|
slaxemulator@7497
|
1168 - if (is_exact && sh == 0)
|
slaxemulator@7497
|
1169 - {
|
slaxemulator@7497
|
1170 - /* For k=0 we can't decide exactness since it may depend
|
slaxemulator@7497
|
1171 - from low order bits.
|
slaxemulator@7497
|
1172 - For k=1, the first low limbs matched: low(b)-low(c)<0. */
|
slaxemulator@7497
|
1173 - if (k)
|
slaxemulator@7497
|
1174 - {
|
slaxemulator@7497
|
1175 - inexact = 1;
|
slaxemulator@7497
|
1176 - goto truncate;
|
slaxemulator@7497
|
1177 - }
|
slaxemulator@7497
|
1178 - }
|
slaxemulator@7497
|
1179 - else if (down && sh == 0)
|
slaxemulator@7497
|
1180 - goto sub_one_ulp;
|
slaxemulator@7497
|
1181 - else
|
slaxemulator@7497
|
1182 - {
|
slaxemulator@7497
|
1183 - inexact = (is_exact) ? 1 : -1;
|
slaxemulator@7497
|
1184 + /* If cmp_low < 0 and bb > cc, then -0.5 ulp < low(b)-low(c) < 0,
|
slaxemulator@7497
|
1185 + whatever the value of sh.
|
slaxemulator@7497
|
1186 + If sh>0, then cmp_low < 0 implies that the initial neglected
|
slaxemulator@7497
|
1187 + sh bits were 0 (otherwise cmp_low=2 initially), thus the
|
slaxemulator@7497
|
1188 + weight of the new bits is less than 0.5 ulp too.
|
slaxemulator@7497
|
1189 + If k > 0 (and sh=0) this means that either the first neglected
|
slaxemulator@7497
|
1190 + limbs bb and cc were equal (thus cmp_low was 0 for k=0),
|
slaxemulator@7497
|
1191 + or we had bb - cc = -0.5 ulp or 0.5 ulp.
|
slaxemulator@7497
|
1192 + The last case is not possible here since we would have
|
slaxemulator@7497
|
1193 + cmp_low > 0 which is sticky.
|
slaxemulator@7497
|
1194 + In the first case (where we have cmp_low = -1), we truncate,
|
slaxemulator@7497
|
1195 + whereas in the 2nd case we have cmp_low = -2 and we subtract
|
slaxemulator@7497
|
1196 + one ulp.
|
slaxemulator@7497
|
1197 + */
|
slaxemulator@7497
|
1198 + if (bb > cc || sh > 0 || cmp_low == -1)
|
slaxemulator@7497
|
1199 + { /* -0.5 ulp < low(b)-low(c) < 0,
|
slaxemulator@7497
|
1200 + bb > cc corresponds to cases 1e and 1f1
|
slaxemulator@7497
|
1201 + sh > 0 corresponds to cases 3c and 3b3
|
slaxemulator@7497
|
1202 + cmp_low = -1 corresponds to case 1d3 (also 3b3) */
|
slaxemulator@7497
|
1203 + inexact = 1;
|
slaxemulator@7497
|
1204 goto truncate;
|
slaxemulator@7497
|
1205 }
|
slaxemulator@7497
|
1206 + else if (bb < cc) /* here sh = 0 and low(b)-low(c) < -0.5 ulp,
|
slaxemulator@7497
|
1207 + this corresponds to cases 1g and 1f3 */
|
slaxemulator@7497
|
1208 + goto sub_one_ulp;
|
slaxemulator@7497
|
1209 + /* the only case where we can't conclude is sh=0 and bb=cc,
|
slaxemulator@7497
|
1210 + i.e., we have low(b) - low(c) = -0.5 ulp (up to now), thus
|
slaxemulator@7497
|
1211 + we don't know if we must truncate or subtract one ulp.
|
slaxemulator@7497
|
1212 + Note: for sh=0 we can't have low(b) - low(c) = -0.5 ulp up to
|
slaxemulator@7497
|
1213 + now, since low(b) - low(c) > 1/2^sh */
|
slaxemulator@7497
|
1214 }
|
slaxemulator@7497
|
1215 }
|
slaxemulator@7497
|
1216 - else if (bb > cc)
|
slaxemulator@7497
|
1217 + else if (cmp_low > 0) /* 0 < low(b) - low(c): either truncate or
|
slaxemulator@7497
|
1218 + add one ulp */
|
slaxemulator@7497
|
1219 {
|
slaxemulator@7497
|
1220 if (rnd_mode == MPFR_RNDZ)
|
slaxemulator@7497
|
1221 {
|
slaxemulator@7497
|
1222 @@ -437,34 +500,70 @@
|
slaxemulator@7497
|
1223 goto add_one_ulp;
|
slaxemulator@7497
|
1224 else /* round to nearest */
|
slaxemulator@7497
|
1225 {
|
slaxemulator@7497
|
1226 - if (is_exact)
|
slaxemulator@7497
|
1227 + if (bb > cc)
|
slaxemulator@7497
|
1228 {
|
slaxemulator@7497
|
1229 - inexact = -1;
|
slaxemulator@7497
|
1230 - goto truncate;
|
slaxemulator@7497
|
1231 + /* if sh=0, then bb>cc means that low(b)-low(c) > 0.5 ulp,
|
slaxemulator@7497
|
1232 + and similarly when cmp_low=2 */
|
slaxemulator@7497
|
1233 + if (cmp_low == 2) /* cases 1a, 1b1, 2a and 2b1 */
|
slaxemulator@7497
|
1234 + goto add_one_ulp;
|
slaxemulator@7497
|
1235 + /* sh > 0 and cmp_low > 0: this implies that the sh initial
|
slaxemulator@7497
|
1236 + neglected bits were 0, and the remaining low(b)-low(c)>0,
|
slaxemulator@7497
|
1237 + but its weight is less than 0.5 ulp */
|
slaxemulator@7497
|
1238 + else /* 0 < low(b) - low(c) < 0.5 ulp, this corresponds to
|
slaxemulator@7497
|
1239 + cases 3a, 1d1 and 3b1 */
|
slaxemulator@7497
|
1240 + {
|
slaxemulator@7497
|
1241 + inexact = -1;
|
slaxemulator@7497
|
1242 + goto truncate;
|
slaxemulator@7497
|
1243 + }
|
slaxemulator@7497
|
1244 }
|
slaxemulator@7497
|
1245 - else if (down)
|
slaxemulator@7497
|
1246 + else if (bb < cc) /* 0 < low(b) - low(c) < 0.5 ulp, cases 1c,
|
slaxemulator@7497
|
1247 + 1b3, 2b3 and 2c */
|
slaxemulator@7497
|
1248 {
|
slaxemulator@7497
|
1249 - inexact = 1;
|
slaxemulator@7497
|
1250 + inexact = -1;
|
slaxemulator@7497
|
1251 goto truncate;
|
slaxemulator@7497
|
1252 }
|
slaxemulator@7497
|
1253 - else
|
slaxemulator@7497
|
1254 - goto add_one_ulp;
|
slaxemulator@7497
|
1255 + /* the only case where we can't conclude is bb=cc, i.e.,
|
slaxemulator@7497
|
1256 + low(b) - low(c) = 0.5 ulp (up to now), thus we don't know
|
slaxemulator@7497
|
1257 + if we must truncate or add one ulp. */
|
slaxemulator@7497
|
1258 }
|
slaxemulator@7497
|
1259 }
|
slaxemulator@7497
|
1260 + /* after k=0, we cannot conclude in the following cases, we split them
|
slaxemulator@7497
|
1261 + according to the values of bb and cc for k=1:
|
slaxemulator@7497
|
1262 + 1b. sh=0 and cmp_low = 1 and bb-cc = half [around 0.5 ulp]
|
slaxemulator@7497
|
1263 + 1b1. bb > cc: add one ulp, inex = 1
|
slaxemulator@7497
|
1264 + 1b2: bb = cc: cannot conclude
|
slaxemulator@7497
|
1265 + 1b3: bb < cc: truncate, inex = -1
|
slaxemulator@7497
|
1266 + 1d. sh=0 and cmp_low = 0 and bb-cc = 0 [around 0]
|
slaxemulator@7497
|
1267 + 1d1: bb > cc: truncate, inex = -1
|
slaxemulator@7497
|
1268 + 1d2: bb = cc: cannot conclude
|
slaxemulator@7497
|
1269 + 1d3: bb < cc: truncate, inex = +1
|
slaxemulator@7497
|
1270 + 1f. sh=0 and cmp_low = -1 and bb-cc = -half [around -0.5 ulp]
|
slaxemulator@7497
|
1271 + 1f1: bb > cc: truncate, inex = +1
|
slaxemulator@7497
|
1272 + 1f2: bb = cc: cannot conclude
|
slaxemulator@7497
|
1273 + 1f3: bb < cc: sub one ulp, inex = -1
|
slaxemulator@7497
|
1274 + 2b. sh > 0 and cmp_low = 2 and bb=cc [around 0.5 ulp]
|
slaxemulator@7497
|
1275 + 2b1. bb > cc: add one ulp, inex = 1
|
slaxemulator@7497
|
1276 + 2b2: bb = cc: cannot conclude
|
slaxemulator@7497
|
1277 + 2b3: bb < cc: truncate, inex = -1
|
slaxemulator@7497
|
1278 + 3b. sh > 0 and cmp_low = 0 [around 0]
|
slaxemulator@7497
|
1279 + 3b1. bb > cc: truncate, inex = -1
|
slaxemulator@7497
|
1280 + 3b2: bb = cc: cannot conclude
|
slaxemulator@7497
|
1281 + 3b3: bb < cc: truncate, inex = +1
|
slaxemulator@7497
|
1282 + */
|
slaxemulator@7497
|
1283 }
|
slaxemulator@7497
|
1284
|
slaxemulator@7497
|
1285 - if ((rnd_mode == MPFR_RNDN) && !is_exact)
|
slaxemulator@7497
|
1286 + if ((rnd_mode == MPFR_RNDN) && cmp_low != 0)
|
slaxemulator@7497
|
1287 {
|
slaxemulator@7497
|
1288 /* even rounding rule */
|
slaxemulator@7497
|
1289 if ((ap[0] >> sh) & 1)
|
slaxemulator@7497
|
1290 {
|
slaxemulator@7497
|
1291 - if (down)
|
slaxemulator@7497
|
1292 + if (cmp_low < 0)
|
slaxemulator@7497
|
1293 goto sub_one_ulp;
|
slaxemulator@7497
|
1294 else
|
slaxemulator@7497
|
1295 goto add_one_ulp;
|
slaxemulator@7497
|
1296 }
|
slaxemulator@7497
|
1297 else
|
slaxemulator@7497
|
1298 - inexact = (down) ? 1 : -1;
|
slaxemulator@7497
|
1299 + inexact = (cmp_low > 0) ? -1 : 1;
|
slaxemulator@7497
|
1300 }
|
slaxemulator@7497
|
1301 else
|
slaxemulator@7497
|
1302 inexact = 0;
|
slaxemulator@7497
|
1303 diff -Naurd mpfr-3.0.0-a/tests/tfma.c mpfr-3.0.0-b/tests/tfma.c
|
slaxemulator@7497
|
1304 --- mpfr-3.0.0-a/tests/tfma.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
1305 +++ mpfr-3.0.0-b/tests/tfma.c 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
1306 @@ -337,6 +337,94 @@
|
slaxemulator@7497
|
1307 mpfr_clears (x, y, z, r, (mpfr_ptr) 0);
|
slaxemulator@7497
|
1308 }
|
slaxemulator@7497
|
1309
|
slaxemulator@7497
|
1310 +static void
|
slaxemulator@7497
|
1311 +bug20101018 (void)
|
slaxemulator@7497
|
1312 +{
|
slaxemulator@7497
|
1313 + mpfr_t x, y, z, t, u;
|
slaxemulator@7497
|
1314 + int i;
|
slaxemulator@7497
|
1315 +
|
slaxemulator@7497
|
1316 + mpfr_init2 (x, 64);
|
slaxemulator@7497
|
1317 + mpfr_init2 (y, 64);
|
slaxemulator@7497
|
1318 + mpfr_init2 (z, 64);
|
slaxemulator@7497
|
1319 + mpfr_init2 (t, 64);
|
slaxemulator@7497
|
1320 + mpfr_init2 (u, 64);
|
slaxemulator@7497
|
1321 +
|
slaxemulator@7497
|
1322 + mpfr_set_str (x, "0xf.fffffffffffffffp-14766", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1323 + mpfr_set_str (y, "-0xf.fffffffffffffffp+317", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1324 + mpfr_set_str (z, "0x8.3ffffffffffe3ffp-14443", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1325 + mpfr_set_str (t, "0x8.7ffffffffffc7ffp-14444", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1326 + i = mpfr_fma (u, x, y, z, MPFR_RNDN);
|
slaxemulator@7497
|
1327 + if (mpfr_cmp (u, t) != 0)
|
slaxemulator@7497
|
1328 + {
|
slaxemulator@7497
|
1329 + printf ("Wrong result in bug20101018 (a)\n");
|
slaxemulator@7497
|
1330 + printf ("Expected ");
|
slaxemulator@7497
|
1331 + mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
|
slaxemulator@7497
|
1332 + printf ("\nGot ");
|
slaxemulator@7497
|
1333 + mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
|
slaxemulator@7497
|
1334 + printf ("\n");
|
slaxemulator@7497
|
1335 + exit (1);
|
slaxemulator@7497
|
1336 + }
|
slaxemulator@7497
|
1337 + if (i <= 0)
|
slaxemulator@7497
|
1338 + {
|
slaxemulator@7497
|
1339 + printf ("Wrong ternary value in bug20101018 (a)\n");
|
slaxemulator@7497
|
1340 + printf ("Expected > 0\n");
|
slaxemulator@7497
|
1341 + printf ("Got %d\n", i);
|
slaxemulator@7497
|
1342 + exit (1);
|
slaxemulator@7497
|
1343 + }
|
slaxemulator@7497
|
1344 +
|
slaxemulator@7497
|
1345 + mpfr_set_str (x, "-0xf.fffffffffffffffp-11420", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1346 + mpfr_set_str (y, "0xf.fffffffffffffffp+9863", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1347 + mpfr_set_str (z, "0x8.fffff80ffffffffp-1551", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1348 + mpfr_set_str (t, "0x9.fffff01ffffffffp-1552", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1349 + i = mpfr_fma (u, x, y, z, MPFR_RNDN);
|
slaxemulator@7497
|
1350 + if (mpfr_cmp (u, t) != 0)
|
slaxemulator@7497
|
1351 + {
|
slaxemulator@7497
|
1352 + printf ("Wrong result in bug20101018 (b)\n");
|
slaxemulator@7497
|
1353 + printf ("Expected ");
|
slaxemulator@7497
|
1354 + mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
|
slaxemulator@7497
|
1355 + printf ("\nGot ");
|
slaxemulator@7497
|
1356 + mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
|
slaxemulator@7497
|
1357 + printf ("\n");
|
slaxemulator@7497
|
1358 + exit (1);
|
slaxemulator@7497
|
1359 + }
|
slaxemulator@7497
|
1360 + if (i <= 0)
|
slaxemulator@7497
|
1361 + {
|
slaxemulator@7497
|
1362 + printf ("Wrong ternary value in bug20101018 (b)\n");
|
slaxemulator@7497
|
1363 + printf ("Expected > 0\n");
|
slaxemulator@7497
|
1364 + printf ("Got %d\n", i);
|
slaxemulator@7497
|
1365 + exit (1);
|
slaxemulator@7497
|
1366 + }
|
slaxemulator@7497
|
1367 +
|
slaxemulator@7497
|
1368 + mpfr_set_str (x, "0xf.fffffffffffffffp-2125", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1369 + mpfr_set_str (y, "-0xf.fffffffffffffffp-6000", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1370 + mpfr_set_str (z, "0x8p-8119", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1371 + mpfr_set_str (t, "0x8.000000000000001p-8120", 16, MPFR_RNDN);
|
slaxemulator@7497
|
1372 + i = mpfr_fma (u, x, y, z, MPFR_RNDN);
|
slaxemulator@7497
|
1373 + if (mpfr_cmp (u, t) != 0)
|
slaxemulator@7497
|
1374 + {
|
slaxemulator@7497
|
1375 + printf ("Wrong result in bug20101018 (c)\n");
|
slaxemulator@7497
|
1376 + printf ("Expected ");
|
slaxemulator@7497
|
1377 + mpfr_out_str (stdout, 16, 0, t, MPFR_RNDN);
|
slaxemulator@7497
|
1378 + printf ("\nGot ");
|
slaxemulator@7497
|
1379 + mpfr_out_str (stdout, 16, 0, u, MPFR_RNDN);
|
slaxemulator@7497
|
1380 + printf ("\n");
|
slaxemulator@7497
|
1381 + exit (1);
|
slaxemulator@7497
|
1382 + }
|
slaxemulator@7497
|
1383 + if (i <= 0)
|
slaxemulator@7497
|
1384 + {
|
slaxemulator@7497
|
1385 + printf ("Wrong ternary value in bug20101018 (c)\n");
|
slaxemulator@7497
|
1386 + printf ("Expected > 0\n");
|
slaxemulator@7497
|
1387 + printf ("Got %d\n", i);
|
slaxemulator@7497
|
1388 + exit (1);
|
slaxemulator@7497
|
1389 + }
|
slaxemulator@7497
|
1390 +
|
slaxemulator@7497
|
1391 + mpfr_clear (x);
|
slaxemulator@7497
|
1392 + mpfr_clear (y);
|
slaxemulator@7497
|
1393 + mpfr_clear (z);
|
slaxemulator@7497
|
1394 + mpfr_clear (t);
|
slaxemulator@7497
|
1395 + mpfr_clear (u);
|
slaxemulator@7497
|
1396 +}
|
slaxemulator@7497
|
1397 +
|
slaxemulator@7497
|
1398 int
|
slaxemulator@7497
|
1399 main (int argc, char *argv[])
|
slaxemulator@7497
|
1400 {
|
slaxemulator@7497
|
1401 @@ -345,6 +433,8 @@
|
slaxemulator@7497
|
1402
|
slaxemulator@7497
|
1403 tests_start_mpfr ();
|
slaxemulator@7497
|
1404
|
slaxemulator@7497
|
1405 + bug20101018 ();
|
slaxemulator@7497
|
1406 +
|
slaxemulator@7497
|
1407 mpfr_init (x);
|
slaxemulator@7497
|
1408 mpfr_init (s);
|
slaxemulator@7497
|
1409 mpfr_init (y);
|
slaxemulator@7497
|
1410 diff -Naurd mpfr-3.0.0-a/tests/tsub.c mpfr-3.0.0-b/tests/tsub.c
|
slaxemulator@7497
|
1411 --- mpfr-3.0.0-a/tests/tsub.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
1412 +++ mpfr-3.0.0-b/tests/tsub.c 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
1413 @@ -201,6 +201,8 @@
|
slaxemulator@7497
|
1414 if (mpfr_cmp (z, x))
|
slaxemulator@7497
|
1415 {
|
slaxemulator@7497
|
1416 printf ("Error in mpfr_sub (2)\n");
|
slaxemulator@7497
|
1417 + printf ("Expected "); mpfr_print_binary (x); puts ("");
|
slaxemulator@7497
|
1418 + printf ("Got "); mpfr_print_binary (z); puts ("");
|
slaxemulator@7497
|
1419 exit (1);
|
slaxemulator@7497
|
1420 }
|
slaxemulator@7497
|
1421 mpfr_set_str_binary (x, "1.1110111011110001110111011111111111101000011001011100101100101101");
|
slaxemulator@7497
|
1422 @@ -478,6 +480,156 @@
|
slaxemulator@7497
|
1423 mpfr_clear (u);
|
slaxemulator@7497
|
1424 }
|
slaxemulator@7497
|
1425
|
slaxemulator@7497
|
1426 +/* Bug found by Jakub Jelinek
|
slaxemulator@7497
|
1427 + * http://bugzilla.redhat.com/643657
|
slaxemulator@7497
|
1428 + * https://gforge.inria.fr/tracker/index.php?func=detail&aid=11301
|
slaxemulator@7497
|
1429 + * The consequence can be either an assertion failure (i = 2 in the
|
slaxemulator@7497
|
1430 + * testcase below, in debug mode) or an incorrectly rounded value.
|
slaxemulator@7497
|
1431 + */
|
slaxemulator@7497
|
1432 +static void
|
slaxemulator@7497
|
1433 +bug20101017 (void)
|
slaxemulator@7497
|
1434 +{
|
slaxemulator@7497
|
1435 + mpfr_t a, b, c;
|
slaxemulator@7497
|
1436 + int inex;
|
slaxemulator@7497
|
1437 + int i;
|
slaxemulator@7497
|
1438 +
|
slaxemulator@7497
|
1439 + mpfr_init2 (a, GMP_NUMB_BITS * 2);
|
slaxemulator@7497
|
1440 + mpfr_init2 (b, GMP_NUMB_BITS);
|
slaxemulator@7497
|
1441 + mpfr_init2 (c, GMP_NUMB_BITS);
|
slaxemulator@7497
|
1442 +
|
slaxemulator@7497
|
1443 + /* a = 2^(2N) + k.2^(2N-1) + 2^N and b = 1
|
slaxemulator@7497
|
1444 + with N = GMP_NUMB_BITS and k = 0 or 1.
|
slaxemulator@7497
|
1445 + c = a - b should round to the same value as a. */
|
slaxemulator@7497
|
1446 +
|
slaxemulator@7497
|
1447 + for (i = 2; i <= 3; i++)
|
slaxemulator@7497
|
1448 + {
|
slaxemulator@7497
|
1449 + mpfr_set_ui_2exp (a, i, GMP_NUMB_BITS - 1, MPFR_RNDN);
|
slaxemulator@7497
|
1450 + mpfr_add_ui (a, a, 1, MPFR_RNDN);
|
slaxemulator@7497
|
1451 + mpfr_mul_2ui (a, a, GMP_NUMB_BITS, MPFR_RNDN);
|
slaxemulator@7497
|
1452 + mpfr_set_ui (b, 1, MPFR_RNDN);
|
slaxemulator@7497
|
1453 + inex = mpfr_sub (c, a, b, MPFR_RNDN);
|
slaxemulator@7497
|
1454 + mpfr_set (b, a, MPFR_RNDN);
|
slaxemulator@7497
|
1455 + if (! mpfr_equal_p (c, b))
|
slaxemulator@7497
|
1456 + {
|
slaxemulator@7497
|
1457 + printf ("Error in bug20101017 for i = %d.\n", i);
|
slaxemulator@7497
|
1458 + printf ("Expected ");
|
slaxemulator@7497
|
1459 + mpfr_out_str (stdout, 16, 0, b, MPFR_RNDN);
|
slaxemulator@7497
|
1460 + putchar ('\n');
|
slaxemulator@7497
|
1461 + printf ("Got ");
|
slaxemulator@7497
|
1462 + mpfr_out_str (stdout, 16, 0, c, MPFR_RNDN);
|
slaxemulator@7497
|
1463 + putchar ('\n');
|
slaxemulator@7497
|
1464 + exit (1);
|
slaxemulator@7497
|
1465 + }
|
slaxemulator@7497
|
1466 + if (inex >= 0)
|
slaxemulator@7497
|
1467 + {
|
slaxemulator@7497
|
1468 + printf ("Error in bug20101017 for i = %d: bad inex value.\n", i);
|
slaxemulator@7497
|
1469 + printf ("Expected negative, got %d.\n", inex);
|
slaxemulator@7497
|
1470 + exit (1);
|
slaxemulator@7497
|
1471 + }
|
slaxemulator@7497
|
1472 + }
|
slaxemulator@7497
|
1473 +
|
slaxemulator@7497
|
1474 + mpfr_set_prec (a, 64);
|
slaxemulator@7497
|
1475 + mpfr_set_prec (b, 129);
|
slaxemulator@7497
|
1476 + mpfr_set_prec (c, 2);
|
slaxemulator@7497
|
1477 + mpfr_set_str_binary (b, "0.100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000001E65");
|
slaxemulator@7497
|
1478 + mpfr_set_str_binary (c, "0.10E1");
|
slaxemulator@7497
|
1479 + inex = mpfr_sub (a, b, c, MPFR_RNDN);
|
slaxemulator@7497
|
1480 + if (mpfr_cmp_ui_2exp (a, 1, 64) != 0 || inex >= 0)
|
slaxemulator@7497
|
1481 + {
|
slaxemulator@7497
|
1482 + printf ("Error in mpfr_sub for b-c for b=2^64+1+2^(-64), c=1\n");
|
slaxemulator@7497
|
1483 + printf ("Expected result 2^64 with inex < 0\n");
|
slaxemulator@7497
|
1484 + printf ("Got "); mpfr_print_binary (a);
|
slaxemulator@7497
|
1485 + printf (" with inex=%d\n", inex);
|
slaxemulator@7497
|
1486 + exit (1);
|
slaxemulator@7497
|
1487 + }
|
slaxemulator@7497
|
1488 +
|
slaxemulator@7497
|
1489 + mpfr_clears (a, b, c, (mpfr_ptr) 0);
|
slaxemulator@7497
|
1490 +}
|
slaxemulator@7497
|
1491 +
|
slaxemulator@7497
|
1492 +/* hard test of rounding */
|
slaxemulator@7497
|
1493 +static void
|
slaxemulator@7497
|
1494 +check_rounding (void)
|
slaxemulator@7497
|
1495 +{
|
slaxemulator@7497
|
1496 + mpfr_t a, b, c, res;
|
slaxemulator@7497
|
1497 + mpfr_prec_t p;
|
slaxemulator@7497
|
1498 + long k, l;
|
slaxemulator@7497
|
1499 + int i;
|
slaxemulator@7497
|
1500 +
|
slaxemulator@7497
|
1501 +#define MAXKL (2 * GMP_NUMB_BITS)
|
slaxemulator@7497
|
1502 + for (p = MPFR_PREC_MIN; p <= GMP_NUMB_BITS; p++)
|
slaxemulator@7497
|
1503 + {
|
slaxemulator@7497
|
1504 + mpfr_init2 (a, p);
|
slaxemulator@7497
|
1505 + mpfr_init2 (res, p);
|
slaxemulator@7497
|
1506 + mpfr_init2 (b, p + 1 + MAXKL);
|
slaxemulator@7497
|
1507 + mpfr_init2 (c, MPFR_PREC_MIN);
|
slaxemulator@7497
|
1508 +
|
slaxemulator@7497
|
1509 + /* b = 2^p + 1 + 2^(-k), c = 2^(-l) */
|
slaxemulator@7497
|
1510 + for (k = 0; k <= MAXKL; k++)
|
slaxemulator@7497
|
1511 + for (l = 0; l <= MAXKL; l++)
|
slaxemulator@7497
|
1512 + {
|
slaxemulator@7497
|
1513 + mpfr_set_ui_2exp (b, 1, p, MPFR_RNDN);
|
slaxemulator@7497
|
1514 + mpfr_add_ui (b, b, 1, MPFR_RNDN);
|
slaxemulator@7497
|
1515 + mpfr_mul_2ui (b, b, k, MPFR_RNDN);
|
slaxemulator@7497
|
1516 + mpfr_add_ui (b, b, 1, MPFR_RNDN);
|
slaxemulator@7497
|
1517 + mpfr_div_2ui (b, b, k, MPFR_RNDN);
|
slaxemulator@7497
|
1518 + mpfr_set_ui_2exp (c, 1, -l, MPFR_RNDN);
|
slaxemulator@7497
|
1519 + i = mpfr_sub (a, b, c, MPFR_RNDN);
|
slaxemulator@7497
|
1520 + /* b - c = 2^p + 1 + 2^(-k) - 2^(-l), should be rounded to
|
slaxemulator@7497
|
1521 + 2^p for l <= k, and 2^p+2 for l < k */
|
slaxemulator@7497
|
1522 + if (l <= k)
|
slaxemulator@7497
|
1523 + {
|
slaxemulator@7497
|
1524 + if (mpfr_cmp_ui_2exp (a, 1, p) != 0)
|
slaxemulator@7497
|
1525 + {
|
slaxemulator@7497
|
1526 + printf ("Wrong result in check_rounding\n");
|
slaxemulator@7497
|
1527 + printf ("p=%lu k=%ld l=%ld\n", p, k, l);
|
slaxemulator@7497
|
1528 + printf ("b="); mpfr_print_binary (b); puts ("");
|
slaxemulator@7497
|
1529 + printf ("c="); mpfr_print_binary (c); puts ("");
|
slaxemulator@7497
|
1530 + printf ("Expected 2^%lu\n", p);
|
slaxemulator@7497
|
1531 + printf ("Got "); mpfr_print_binary (a); puts ("");
|
slaxemulator@7497
|
1532 + exit (1);
|
slaxemulator@7497
|
1533 + }
|
slaxemulator@7497
|
1534 + if (i >= 0)
|
slaxemulator@7497
|
1535 + {
|
slaxemulator@7497
|
1536 + printf ("Wrong ternary value in check_rounding\n");
|
slaxemulator@7497
|
1537 + printf ("p=%lu k=%ld l=%ld\n", p, k, l);
|
slaxemulator@7497
|
1538 + printf ("b="); mpfr_print_binary (b); puts ("");
|
slaxemulator@7497
|
1539 + printf ("c="); mpfr_print_binary (c); puts ("");
|
slaxemulator@7497
|
1540 + printf ("a="); mpfr_print_binary (a); puts ("");
|
slaxemulator@7497
|
1541 + printf ("Expected < 0, got %d\n", i);
|
slaxemulator@7497
|
1542 + exit (1);
|
slaxemulator@7497
|
1543 + }
|
slaxemulator@7497
|
1544 + }
|
slaxemulator@7497
|
1545 + else /* l < k */
|
slaxemulator@7497
|
1546 + {
|
slaxemulator@7497
|
1547 + mpfr_set_ui_2exp (res, 1, p, MPFR_RNDN);
|
slaxemulator@7497
|
1548 + mpfr_add_ui (res, res, 2, MPFR_RNDN);
|
slaxemulator@7497
|
1549 + if (mpfr_cmp (a, res) != 0)
|
slaxemulator@7497
|
1550 + {
|
slaxemulator@7497
|
1551 + printf ("Wrong result in check_rounding\n");
|
slaxemulator@7497
|
1552 + printf ("b="); mpfr_print_binary (b); puts ("");
|
slaxemulator@7497
|
1553 + printf ("c="); mpfr_print_binary (c); puts ("");
|
slaxemulator@7497
|
1554 + printf ("Expected "); mpfr_print_binary (res); puts ("");
|
slaxemulator@7497
|
1555 + printf ("Got "); mpfr_print_binary (a); puts ("");
|
slaxemulator@7497
|
1556 + exit (1);
|
slaxemulator@7497
|
1557 + }
|
slaxemulator@7497
|
1558 + if (i <= 0)
|
slaxemulator@7497
|
1559 + {
|
slaxemulator@7497
|
1560 + printf ("Wrong ternary value in check_rounding\n");
|
slaxemulator@7497
|
1561 + printf ("b="); mpfr_print_binary (b); puts ("");
|
slaxemulator@7497
|
1562 + printf ("c="); mpfr_print_binary (c); puts ("");
|
slaxemulator@7497
|
1563 + printf ("Expected > 0, got %d\n", i);
|
slaxemulator@7497
|
1564 + exit (1);
|
slaxemulator@7497
|
1565 + }
|
slaxemulator@7497
|
1566 + }
|
slaxemulator@7497
|
1567 + }
|
slaxemulator@7497
|
1568 +
|
slaxemulator@7497
|
1569 + mpfr_clear (a);
|
slaxemulator@7497
|
1570 + mpfr_clear (res);
|
slaxemulator@7497
|
1571 + mpfr_clear (b);
|
slaxemulator@7497
|
1572 + mpfr_clear (c);
|
slaxemulator@7497
|
1573 + }
|
slaxemulator@7497
|
1574 +}
|
slaxemulator@7497
|
1575 +
|
slaxemulator@7497
|
1576 #define TEST_FUNCTION test_sub
|
slaxemulator@7497
|
1577 #define TWO_ARGS
|
slaxemulator@7497
|
1578 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS)
|
slaxemulator@7497
|
1579 @@ -491,6 +643,8 @@
|
slaxemulator@7497
|
1580
|
slaxemulator@7497
|
1581 tests_start_mpfr ();
|
slaxemulator@7497
|
1582
|
slaxemulator@7497
|
1583 + bug20101017 ();
|
slaxemulator@7497
|
1584 + check_rounding ();
|
slaxemulator@7497
|
1585 check_diverse ();
|
slaxemulator@7497
|
1586 check_inexact ();
|
slaxemulator@7497
|
1587 bug_ddefour ();
|
slaxemulator@7497
|
1588 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
1589 --- mpfr-3.0.0-a/version.c 2010-10-21 20:28:38.000000000 +0000
|
slaxemulator@7497
|
1590 +++ mpfr-3.0.0-b/version.c 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
1591 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
1592 const char *
|
slaxemulator@7497
|
1593 mpfr_get_version (void)
|
slaxemulator@7497
|
1594 {
|
slaxemulator@7497
|
1595 - return "3.0.0-p5";
|
slaxemulator@7497
|
1596 + return "3.0.0-p6";
|
slaxemulator@7497
|
1597 }
|
slaxemulator@7497
|
1598 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
1599 --- mpfr-3.0.0-a/PATCHES 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1600 +++ mpfr-3.0.0-b/PATCHES 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1601 @@ -0,0 +1 @@
|
slaxemulator@7497
|
1602 +mpfr_set_ld
|
slaxemulator@7497
|
1603 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
1604 --- mpfr-3.0.0-a/VERSION 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
1605 +++ mpfr-3.0.0-b/VERSION 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1606 @@ -1 +1 @@
|
slaxemulator@7497
|
1607 -3.0.0-p6
|
slaxemulator@7497
|
1608 +3.0.0-p7
|
slaxemulator@7497
|
1609 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
1610 --- mpfr-3.0.0-a/mpfr.h 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
1611 +++ mpfr-3.0.0-b/mpfr.h 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1612 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
1613 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
1614 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
1615 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
1616 -#define MPFR_VERSION_STRING "3.0.0-p6"
|
slaxemulator@7497
|
1617 +#define MPFR_VERSION_STRING "3.0.0-p7"
|
slaxemulator@7497
|
1618
|
slaxemulator@7497
|
1619 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
1620 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
1621 diff -Naurd mpfr-3.0.0-a/set_ld.c mpfr-3.0.0-b/set_ld.c
|
slaxemulator@7497
|
1622 --- mpfr-3.0.0-a/set_ld.c 2010-06-10 11:00:14.000000000 +0000
|
slaxemulator@7497
|
1623 +++ mpfr-3.0.0-b/set_ld.c 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1624 @@ -102,21 +102,25 @@
|
slaxemulator@7497
|
1625 {
|
slaxemulator@7497
|
1626 x /= div13; /* exact */
|
slaxemulator@7497
|
1627 shift_exp += 8192;
|
slaxemulator@7497
|
1628 + mpfr_div_2si (t, t, 8192, MPFR_RNDZ);
|
slaxemulator@7497
|
1629 }
|
slaxemulator@7497
|
1630 if (ABS (x) >= div12)
|
slaxemulator@7497
|
1631 {
|
slaxemulator@7497
|
1632 x /= div12; /* exact */
|
slaxemulator@7497
|
1633 shift_exp += 4096;
|
slaxemulator@7497
|
1634 + mpfr_div_2si (t, t, 4096, MPFR_RNDZ);
|
slaxemulator@7497
|
1635 }
|
slaxemulator@7497
|
1636 if (ABS (x) >= div11)
|
slaxemulator@7497
|
1637 {
|
slaxemulator@7497
|
1638 x /= div11; /* exact */
|
slaxemulator@7497
|
1639 shift_exp += 2048;
|
slaxemulator@7497
|
1640 + mpfr_div_2si (t, t, 2048, MPFR_RNDZ);
|
slaxemulator@7497
|
1641 }
|
slaxemulator@7497
|
1642 if (ABS (x) >= div10)
|
slaxemulator@7497
|
1643 {
|
slaxemulator@7497
|
1644 x /= div10; /* exact */
|
slaxemulator@7497
|
1645 shift_exp += 1024;
|
slaxemulator@7497
|
1646 + mpfr_div_2si (t, t, 1024, MPFR_RNDZ);
|
slaxemulator@7497
|
1647 }
|
slaxemulator@7497
|
1648 /* warning: we may have DBL_MAX=2^1024*(1-2^(-53)) < x < 2^1024,
|
slaxemulator@7497
|
1649 therefore we have one extra exponent reduction step */
|
slaxemulator@7497
|
1650 @@ -124,9 +128,10 @@
|
slaxemulator@7497
|
1651 {
|
slaxemulator@7497
|
1652 x /= div9; /* exact */
|
slaxemulator@7497
|
1653 shift_exp += 512;
|
slaxemulator@7497
|
1654 + mpfr_div_2si (t, t, 512, MPFR_RNDZ);
|
slaxemulator@7497
|
1655 }
|
slaxemulator@7497
|
1656 } /* Check overflow of double */
|
slaxemulator@7497
|
1657 - else
|
slaxemulator@7497
|
1658 + else /* no overflow on double */
|
slaxemulator@7497
|
1659 {
|
slaxemulator@7497
|
1660 long double div9, div10, div11;
|
slaxemulator@7497
|
1661
|
slaxemulator@7497
|
1662 @@ -149,29 +154,34 @@
|
slaxemulator@7497
|
1663 {
|
slaxemulator@7497
|
1664 x /= div13; /* exact */
|
slaxemulator@7497
|
1665 shift_exp -= 8192;
|
slaxemulator@7497
|
1666 + mpfr_mul_2si (t, t, 8192, MPFR_RNDZ);
|
slaxemulator@7497
|
1667 }
|
slaxemulator@7497
|
1668 if (ABS (x) <= div12)
|
slaxemulator@7497
|
1669 {
|
slaxemulator@7497
|
1670 x /= div12; /* exact */
|
slaxemulator@7497
|
1671 shift_exp -= 4096;
|
slaxemulator@7497
|
1672 + mpfr_mul_2si (t, t, 4096, MPFR_RNDZ);
|
slaxemulator@7497
|
1673 }
|
slaxemulator@7497
|
1674 if (ABS (x) <= div11)
|
slaxemulator@7497
|
1675 {
|
slaxemulator@7497
|
1676 x /= div11; /* exact */
|
slaxemulator@7497
|
1677 shift_exp -= 2048;
|
slaxemulator@7497
|
1678 + mpfr_mul_2si (t, t, 2048, MPFR_RNDZ);
|
slaxemulator@7497
|
1679 }
|
slaxemulator@7497
|
1680 if (ABS (x) <= div10)
|
slaxemulator@7497
|
1681 {
|
slaxemulator@7497
|
1682 x /= div10; /* exact */
|
slaxemulator@7497
|
1683 shift_exp -= 1024;
|
slaxemulator@7497
|
1684 + mpfr_mul_2si (t, t, 1024, MPFR_RNDZ);
|
slaxemulator@7497
|
1685 }
|
slaxemulator@7497
|
1686 if (ABS(x) <= div9)
|
slaxemulator@7497
|
1687 {
|
slaxemulator@7497
|
1688 x /= div9; /* exact */
|
slaxemulator@7497
|
1689 shift_exp -= 512;
|
slaxemulator@7497
|
1690 + mpfr_mul_2si (t, t, 512, MPFR_RNDZ);
|
slaxemulator@7497
|
1691 }
|
slaxemulator@7497
|
1692 }
|
slaxemulator@7497
|
1693 - else
|
slaxemulator@7497
|
1694 + else /* no underflow */
|
slaxemulator@7497
|
1695 {
|
slaxemulator@7497
|
1696 inexact = mpfr_set_d (u, (double) x, MPFR_RNDZ);
|
slaxemulator@7497
|
1697 MPFR_ASSERTD (inexact == 0);
|
slaxemulator@7497
|
1698 diff -Naurd mpfr-3.0.0-a/tests/tset_ld.c mpfr-3.0.0-b/tests/tset_ld.c
|
slaxemulator@7497
|
1699 --- mpfr-3.0.0-a/tests/tset_ld.c 2010-06-10 11:00:13.000000000 +0000
|
slaxemulator@7497
|
1700 +++ mpfr-3.0.0-b/tests/tset_ld.c 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1701 @@ -147,12 +147,39 @@
|
slaxemulator@7497
|
1702 test_fixed_bugs (void)
|
slaxemulator@7497
|
1703 {
|
slaxemulator@7497
|
1704 mpfr_t x;
|
slaxemulator@7497
|
1705 - long double d;
|
slaxemulator@7497
|
1706 + long double l, m;
|
slaxemulator@7497
|
1707
|
slaxemulator@7497
|
1708 /* bug found by Steve Kargl (2009-03-14) */
|
slaxemulator@7497
|
1709 mpfr_init2 (x, 64);
|
slaxemulator@7497
|
1710 mpfr_set_ui_2exp (x, 1, -16447, MPFR_RNDN);
|
slaxemulator@7497
|
1711 - d = mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
|
slaxemulator@7497
|
1712 + mpfr_get_ld (x, MPFR_RNDN); /* an assertion failed in init2.c:50 */
|
slaxemulator@7497
|
1713 +
|
slaxemulator@7497
|
1714 + /* bug reported by Jakub Jelinek (2010-10-17)
|
slaxemulator@7497
|
1715 + https://gforge.inria.fr/tracker/?func=detail&aid=11300 */
|
slaxemulator@7497
|
1716 + mpfr_set_prec (x, MPFR_LDBL_MANT_DIG);
|
slaxemulator@7497
|
1717 + /* l = 0x1.23456789abcdef0123456789abcdp-914L; */
|
slaxemulator@7497
|
1718 + l = 8.215640181713713164092636634579e-276;
|
slaxemulator@7497
|
1719 + mpfr_set_ld (x, l, MPFR_RNDN);
|
slaxemulator@7497
|
1720 + m = mpfr_get_ld (x, MPFR_RNDN);
|
slaxemulator@7497
|
1721 + if (m != l)
|
slaxemulator@7497
|
1722 + {
|
slaxemulator@7497
|
1723 + printf ("Error in get_ld o set_ld for l=%Le\n", l);
|
slaxemulator@7497
|
1724 + printf ("Got m=%Le instead of l\n", m);
|
slaxemulator@7497
|
1725 + exit (1);
|
slaxemulator@7497
|
1726 + }
|
slaxemulator@7497
|
1727 +
|
slaxemulator@7497
|
1728 + /* another similar test which failed with extended double precision and the
|
slaxemulator@7497
|
1729 + generic code for mpfr_set_ld */
|
slaxemulator@7497
|
1730 + /* l = 0x1.23456789abcdef0123456789abcdp-968L; */
|
slaxemulator@7497
|
1731 + l = 4.560596445887084662336528403703e-292;
|
slaxemulator@7497
|
1732 + mpfr_set_ld (x, l, MPFR_RNDN);
|
slaxemulator@7497
|
1733 + m = mpfr_get_ld (x, MPFR_RNDN);
|
slaxemulator@7497
|
1734 + if (m != l)
|
slaxemulator@7497
|
1735 + {
|
slaxemulator@7497
|
1736 + printf ("Error in get_ld o set_ld for l=%Le\n", l);
|
slaxemulator@7497
|
1737 + printf ("Got m=%Le instead of l\n", m);
|
slaxemulator@7497
|
1738 + exit (1);
|
slaxemulator@7497
|
1739 + }
|
slaxemulator@7497
|
1740
|
slaxemulator@7497
|
1741 mpfr_clear (x);
|
slaxemulator@7497
|
1742 }
|
slaxemulator@7497
|
1743 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
1744 --- mpfr-3.0.0-a/version.c 2010-10-21 20:59:32.000000000 +0000
|
slaxemulator@7497
|
1745 +++ mpfr-3.0.0-b/version.c 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1746 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
1747 const char *
|
slaxemulator@7497
|
1748 mpfr_get_version (void)
|
slaxemulator@7497
|
1749 {
|
slaxemulator@7497
|
1750 - return "3.0.0-p6";
|
slaxemulator@7497
|
1751 + return "3.0.0-p7";
|
slaxemulator@7497
|
1752 }
|
slaxemulator@7497
|
1753 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
|
slaxemulator@7497
|
1754 --- mpfr-3.0.0-a/PATCHES 2010-11-09 15:15:07.000000000 +0000
|
slaxemulator@7497
|
1755 +++ mpfr-3.0.0-b/PATCHES 2010-11-09 15:15:07.000000000 +0000
|
slaxemulator@7497
|
1756 @@ -0,0 +1 @@
|
slaxemulator@7497
|
1757 +macros
|
slaxemulator@7497
|
1758 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
|
slaxemulator@7497
|
1759 --- mpfr-3.0.0-a/VERSION 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1760 +++ mpfr-3.0.0-b/VERSION 2010-11-09 15:15:07.000000000 +0000
|
slaxemulator@7497
|
1761 @@ -1 +1 @@
|
slaxemulator@7497
|
1762 -3.0.0-p7
|
slaxemulator@7497
|
1763 +3.0.0-p8
|
slaxemulator@7497
|
1764 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
|
slaxemulator@7497
|
1765 --- mpfr-3.0.0-a/mpfr.h 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1766 +++ mpfr-3.0.0-b/mpfr.h 2010-11-09 15:15:07.000000000 +0000
|
slaxemulator@7497
|
1767 @@ -27,7 +27,7 @@
|
slaxemulator@7497
|
1768 #define MPFR_VERSION_MAJOR 3
|
slaxemulator@7497
|
1769 #define MPFR_VERSION_MINOR 0
|
slaxemulator@7497
|
1770 #define MPFR_VERSION_PATCHLEVEL 0
|
slaxemulator@7497
|
1771 -#define MPFR_VERSION_STRING "3.0.0-p7"
|
slaxemulator@7497
|
1772 +#define MPFR_VERSION_STRING "3.0.0-p8"
|
slaxemulator@7497
|
1773
|
slaxemulator@7497
|
1774 /* Macros dealing with MPFR VERSION */
|
slaxemulator@7497
|
1775 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
|
slaxemulator@7497
|
1776 @@ -67,6 +67,16 @@
|
slaxemulator@7497
|
1777 # define _MPFR_H_HAVE_INTMAX_T 1
|
slaxemulator@7497
|
1778 #endif
|
slaxemulator@7497
|
1779
|
slaxemulator@7497
|
1780 +/* Avoid some problems with macro expansion if the user defines macros
|
slaxemulator@7497
|
1781 + with the same name as keywords. By convention, identifiers and macro
|
slaxemulator@7497
|
1782 + names starting with mpfr_ are reserved by MPFR. */
|
slaxemulator@7497
|
1783 +typedef void mpfr_void;
|
slaxemulator@7497
|
1784 +typedef int mpfr_int;
|
slaxemulator@7497
|
1785 +typedef unsigned int mpfr_uint;
|
slaxemulator@7497
|
1786 +typedef long mpfr_long;
|
slaxemulator@7497
|
1787 +typedef unsigned long mpfr_ulong;
|
slaxemulator@7497
|
1788 +typedef size_t mpfr_size_t;
|
slaxemulator@7497
|
1789 +
|
slaxemulator@7497
|
1790 /* Definition of rounding modes (DON'T USE MPFR_RNDNA!).
|
slaxemulator@7497
|
1791 Warning! Changing the contents of this enum should be seen as an
|
slaxemulator@7497
|
1792 interface change since the old and the new types are not compatible
|
slaxemulator@7497
|
1793 @@ -136,7 +146,7 @@
|
slaxemulator@7497
|
1794 typedef mp_exp_t mpfr_exp_t;
|
slaxemulator@7497
|
1795
|
slaxemulator@7497
|
1796 /* Definition of the standard exponent limits */
|
slaxemulator@7497
|
1797 -#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((unsigned long) 1 << 30) - 1))
|
slaxemulator@7497
|
1798 +#define MPFR_EMAX_DEFAULT ((mpfr_exp_t) (((mpfr_ulong) 1 << 30) - 1))
|
slaxemulator@7497
|
1799 #define MPFR_EMIN_DEFAULT (-(MPFR_EMAX_DEFAULT))
|
slaxemulator@7497
|
1800
|
slaxemulator@7497
|
1801 /* Definition of the main structure */
|
slaxemulator@7497
|
1802 @@ -725,13 +735,13 @@
|
slaxemulator@7497
|
1803 unexpected results with future compilers and aggressive optimisations.
|
slaxemulator@7497
|
1804 Why not working only with signed types, using INT_MIN and LONG_MIN? */
|
slaxemulator@7497
|
1805 #if __GMP_MP_SIZE_T_INT
|
slaxemulator@7497
|
1806 -#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+2))
|
slaxemulator@7497
|
1807 -#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+1))
|
slaxemulator@7497
|
1808 -#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned int)0)>>1))+3))
|
slaxemulator@7497
|
1809 +#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+2))
|
slaxemulator@7497
|
1810 +#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+1))
|
slaxemulator@7497
|
1811 +#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_uint)0)>>1))+3))
|
slaxemulator@7497
|
1812 #else
|
slaxemulator@7497
|
1813 -#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+2))
|
slaxemulator@7497
|
1814 -#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+1))
|
slaxemulator@7497
|
1815 -#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(unsigned long)0)>>1))+3))
|
slaxemulator@7497
|
1816 +#define __MPFR_EXP_NAN ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+2))
|
slaxemulator@7497
|
1817 +#define __MPFR_EXP_ZERO ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+1))
|
slaxemulator@7497
|
1818 +#define __MPFR_EXP_INF ((mpfr_exp_t)((~((~(mpfr_ulong)0)>>1))+3))
|
slaxemulator@7497
|
1819 #endif
|
slaxemulator@7497
|
1820
|
slaxemulator@7497
|
1821 /* Define MPFR_USE_EXTENSION to avoid "gcc -pedantic" warnings. */
|
slaxemulator@7497
|
1822 @@ -760,9 +770,9 @@
|
slaxemulator@7497
|
1823 #define mpfr_inf_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_INF)
|
slaxemulator@7497
|
1824 #define mpfr_zero_p(_x) ((_x)->_mpfr_exp == __MPFR_EXP_ZERO)
|
slaxemulator@7497
|
1825 #define mpfr_regular_p(_x) ((_x)->_mpfr_exp > __MPFR_EXP_INF)
|
slaxemulator@7497
|
1826 -#define mpfr_sgn(_x) \
|
slaxemulator@7497
|
1827 - ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
|
slaxemulator@7497
|
1828 - (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (void) 0), 0 : \
|
slaxemulator@7497
|
1829 +#define mpfr_sgn(_x) \
|
slaxemulator@7497
|
1830 + ((_x)->_mpfr_exp < __MPFR_EXP_INF ? \
|
slaxemulator@7497
|
1831 + (mpfr_nan_p (_x) ? mpfr_set_erangeflag () : (mpfr_void) 0), 0 : \
|
slaxemulator@7497
|
1832 MPFR_SIGN (_x))
|
slaxemulator@7497
|
1833
|
slaxemulator@7497
|
1834 /* Prevent them from using as lvalues */
|
slaxemulator@7497
|
1835 @@ -805,7 +815,19 @@
|
slaxemulator@7497
|
1836 Moreover casts to unsigned long have been added to avoid warnings in
|
slaxemulator@7497
|
1837 programs that use MPFR and are compiled with -Wconversion; such casts
|
slaxemulator@7497
|
1838 are OK since if X is a constant expression, then (unsigned long) X is
|
slaxemulator@7497
|
1839 - also a constant expression, so that the optimizations still work. */
|
slaxemulator@7497
|
1840 + also a constant expression, so that the optimizations still work. The
|
slaxemulator@7497
|
1841 + warnings are probably related to the following two bugs:
|
slaxemulator@7497
|
1842 + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=4210
|
slaxemulator@7497
|
1843 + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38470 (possibly a variant)
|
slaxemulator@7497
|
1844 + and the casts could be removed once these bugs are fixed.
|
slaxemulator@7497
|
1845 + Casts shouldn't be used on the generic calls (to the ..._2exp functions),
|
slaxemulator@7497
|
1846 + where implicit conversions are performed. Indeed, having at least one
|
slaxemulator@7497
|
1847 + implicit conversion in the macro allows the compiler to emit diagnostics
|
slaxemulator@7497
|
1848 + when normally expected, for instance in the following call:
|
slaxemulator@7497
|
1849 + mpfr_set_ui (x, "foo", MPFR_RNDN);
|
slaxemulator@7497
|
1850 + If this is not possible (for future macros), one of the tricks described
|
slaxemulator@7497
|
1851 + on http://groups.google.com/group/comp.std.c/msg/e92abd24bf9eaf7b could
|
slaxemulator@7497
|
1852 + be used. */
|
slaxemulator@7497
|
1853 #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
|
slaxemulator@7497
|
1854 #if (__GNUC__ >= 2)
|
slaxemulator@7497
|
1855 #undef mpfr_cmp_ui
|
slaxemulator@7497
|
1856 @@ -813,45 +835,45 @@
|
slaxemulator@7497
|
1857 But warning! mpfr_sgn is specified as a macro in the API, thus the macro
|
slaxemulator@7497
|
1858 mustn't be used if side effects are possible, like here. */
|
slaxemulator@7497
|
1859 #define mpfr_cmp_ui(_f,_u) \
|
slaxemulator@7497
|
1860 - (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
|
slaxemulator@7497
|
1861 + (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
|
slaxemulator@7497
|
1862 (mpfr_sgn) (_f) : \
|
slaxemulator@7497
|
1863 - mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
|
slaxemulator@7497
|
1864 + mpfr_cmp_ui_2exp ((_f), (_u), 0))
|
slaxemulator@7497
|
1865 #undef mpfr_cmp_si
|
slaxemulator@7497
|
1866 -#define mpfr_cmp_si(_f,_s) \
|
slaxemulator@7497
|
1867 - (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
|
slaxemulator@7497
|
1868 - mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
|
slaxemulator@7497
|
1869 - mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
|
slaxemulator@7497
|
1870 +#define mpfr_cmp_si(_f,_s) \
|
slaxemulator@7497
|
1871 + (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
|
slaxemulator@7497
|
1872 + mpfr_cmp_ui ((_f), (mpfr_ulong) (mpfr_long) (_s)) : \
|
slaxemulator@7497
|
1873 + mpfr_cmp_si_2exp ((_f), (_s), 0))
|
slaxemulator@7497
|
1874 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
|
slaxemulator@7497
|
1875 #undef mpfr_set_ui
|
slaxemulator@7497
|
1876 #define mpfr_set_ui(_f,_u,_r) \
|
slaxemulator@7497
|
1877 - (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
|
slaxemulator@7497
|
1878 + (__builtin_constant_p (_u) && (mpfr_ulong) (_u) == 0 ? \
|
slaxemulator@7497
|
1879 __extension__ ({ \
|
slaxemulator@7497
|
1880 mpfr_ptr _p = (_f); \
|
slaxemulator@7497
|
1881 _p->_mpfr_sign = 1; \
|
slaxemulator@7497
|
1882 _p->_mpfr_exp = __MPFR_EXP_ZERO; \
|
slaxemulator@7497
|
1883 - (void) (_r); 0; }) : \
|
slaxemulator@7497
|
1884 - mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
|
slaxemulator@7497
|
1885 + (mpfr_void) (_r); 0; }) : \
|
slaxemulator@7497
|
1886 + mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
|
slaxemulator@7497
|
1887 #endif
|
slaxemulator@7497
|
1888 #undef mpfr_set_si
|
slaxemulator@7497
|
1889 #define mpfr_set_si(_f,_s,_r) \
|
slaxemulator@7497
|
1890 - (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
|
slaxemulator@7497
|
1891 - mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
|
slaxemulator@7497
|
1892 - mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
|
slaxemulator@7497
|
1893 + (__builtin_constant_p (_s) && (mpfr_long) (_s) >= 0 ? \
|
slaxemulator@7497
|
1894 + mpfr_set_ui ((_f), (mpfr_ulong) (mpfr_long) (_s), (_r)) : \
|
slaxemulator@7497
|
1895 + mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
|
slaxemulator@7497
|
1896 #endif
|
slaxemulator@7497
|
1897 #endif
|
slaxemulator@7497
|
1898
|
slaxemulator@7497
|
1899 /* Macro version of mpfr_stack interface for fast access */
|
slaxemulator@7497
|
1900 -#define mpfr_custom_get_size(p) ((size_t) \
|
slaxemulator@7497
|
1901 +#define mpfr_custom_get_size(p) ((mpfr_size_t) \
|
slaxemulator@7497
|
1902 (((p)+GMP_NUMB_BITS-1)/GMP_NUMB_BITS*sizeof (mp_limb_t)))
|
slaxemulator@7497
|
1903 #define mpfr_custom_init(m,p) do {} while (0)
|
slaxemulator@7497
|
1904 -#define mpfr_custom_get_significand(x) ((void*)((x)->_mpfr_d))
|
slaxemulator@7497
|
1905 +#define mpfr_custom_get_significand(x) ((mpfr_void*)((x)->_mpfr_d))
|
slaxemulator@7497
|
1906 #define mpfr_custom_get_exp(x) ((x)->_mpfr_exp)
|
slaxemulator@7497
|
1907 #define mpfr_custom_move(x,m) do { ((x)->_mpfr_d = (mp_limb_t*)(m)); } while (0)
|
slaxemulator@7497
|
1908 #define mpfr_custom_init_set(x,k,e,p,m) do { \
|
slaxemulator@7497
|
1909 mpfr_ptr _x = (x); \
|
slaxemulator@7497
|
1910 mpfr_exp_t _e; \
|
slaxemulator@7497
|
1911 mpfr_kind_t _t; \
|
slaxemulator@7497
|
1912 - int _s, _k; \
|
slaxemulator@7497
|
1913 + mpfr_int _s, _k; \
|
slaxemulator@7497
|
1914 _k = (k); \
|
slaxemulator@7497
|
1915 if (_k >= 0) { \
|
slaxemulator@7497
|
1916 _t = (mpfr_kind_t) _k; \
|
slaxemulator@7497
|
1917 @@ -868,11 +890,13 @@
|
slaxemulator@7497
|
1918 _x->_mpfr_exp = _e; \
|
slaxemulator@7497
|
1919 _x->_mpfr_d = (mp_limb_t*) (m); \
|
slaxemulator@7497
|
1920 } while (0)
|
slaxemulator@7497
|
1921 -#define mpfr_custom_get_kind(x) \
|
slaxemulator@7497
|
1922 - ( (x)->_mpfr_exp > __MPFR_EXP_INF ? (int)MPFR_REGULAR_KIND*MPFR_SIGN (x) \
|
slaxemulator@7497
|
1923 - : (x)->_mpfr_exp == __MPFR_EXP_INF ? (int)MPFR_INF_KIND*MPFR_SIGN (x) \
|
slaxemulator@7497
|
1924 - : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (int)MPFR_NAN_KIND \
|
slaxemulator@7497
|
1925 - : (int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
|
slaxemulator@7497
|
1926 +#define mpfr_custom_get_kind(x) \
|
slaxemulator@7497
|
1927 + ( (x)->_mpfr_exp > __MPFR_EXP_INF ? \
|
slaxemulator@7497
|
1928 + (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (x) \
|
slaxemulator@7497
|
1929 + : (x)->_mpfr_exp == __MPFR_EXP_INF ? \
|
slaxemulator@7497
|
1930 + (mpfr_int) MPFR_INF_KIND * MPFR_SIGN (x) \
|
slaxemulator@7497
|
1931 + : (x)->_mpfr_exp == __MPFR_EXP_NAN ? (mpfr_int) MPFR_NAN_KIND \
|
slaxemulator@7497
|
1932 + : (mpfr_int) MPFR_ZERO_KIND * MPFR_SIGN (x) )
|
slaxemulator@7497
|
1933
|
slaxemulator@7497
|
1934
|
slaxemulator@7497
|
1935 #endif /* MPFR_USE_NO_MACRO */
|
slaxemulator@7497
|
1936 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
|
slaxemulator@7497
|
1937 --- mpfr-3.0.0-a/version.c 2010-10-21 21:18:26.000000000 +0000
|
slaxemulator@7497
|
1938 +++ mpfr-3.0.0-b/version.c 2010-11-09 15:15:07.000000000 +0000
|
slaxemulator@7497
|
1939 @@ -25,5 +25,5 @@
|
slaxemulator@7497
|
1940 const char *
|
slaxemulator@7497
|
1941 mpfr_get_version (void)
|
slaxemulator@7497
|
1942 {
|
slaxemulator@7497
|
1943 - return "3.0.0-p7";
|
slaxemulator@7497
|
1944 + return "3.0.0-p8";
|
slaxemulator@7497
|
1945 }
|