wok-next annotate mpfr/stuff/mpfr-3.0.0-p4.patch @ rev 6929

Up: mpfr to 3.0.0p4. Added a EXTRAVERSION since i patching it with p4 patch.
author Christopher Rogers <slaxemulator@gmail.com>
date Fri Oct 22 23:13:10 2010 +0000 (2010-10-22)
parents mpfr/stuff/mpfr-3.0.0-p3.patch@fe92c91d5083
children
rev   line source
slaxemulator@6517 1 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
slaxemulator@6517 2 --- mpfr-3.0.0-a/PATCHES 2010-06-23 11:02:49.000000000 +0000
slaxemulator@6517 3 +++ mpfr-3.0.0-b/PATCHES 2010-06-23 11:03:36.000000000 +0000
slaxemulator@6517 4 @@ -0,0 +1 @@
slaxemulator@6517 5 +mpfr_out_str
slaxemulator@6517 6 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
slaxemulator@6517 7 --- mpfr-3.0.0-a/VERSION 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 8 +++ mpfr-3.0.0-b/VERSION 2010-06-23 11:03:20.000000000 +0000
slaxemulator@6517 9 @@ -1 +1 @@
slaxemulator@6517 10 -3.0.0
slaxemulator@6517 11 +3.0.0-p1
slaxemulator@6517 12 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
slaxemulator@6517 13 --- mpfr-3.0.0-a/mpfr.h 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 14 +++ mpfr-3.0.0-b/mpfr.h 2010-06-23 11:03:20.000000000 +0000
slaxemulator@6517 15 @@ -27,7 +27,7 @@
slaxemulator@6517 16 #define MPFR_VERSION_MAJOR 3
slaxemulator@6517 17 #define MPFR_VERSION_MINOR 0
slaxemulator@6517 18 #define MPFR_VERSION_PATCHLEVEL 0
slaxemulator@6517 19 -#define MPFR_VERSION_STRING "3.0.0"
slaxemulator@6517 20 +#define MPFR_VERSION_STRING "3.0.0-p1"
slaxemulator@6517 21
slaxemulator@6517 22 /* Macros dealing with MPFR VERSION */
slaxemulator@6517 23 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
slaxemulator@6517 24 diff -Naurd mpfr-3.0.0-a/mpfr.texi mpfr-3.0.0-b/mpfr.texi
slaxemulator@6517 25 --- mpfr-3.0.0-a/mpfr.texi 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 26 +++ mpfr-3.0.0-b/mpfr.texi 2010-06-23 11:03:12.000000000 +0000
slaxemulator@6517 27 @@ -2050,7 +2050,7 @@
slaxemulator@6517 28 are printed. If @var{base} is greater than 10, @samp{@@} will be used
slaxemulator@6517 29 instead of @samp{e} as exponent delimiter.
slaxemulator@6517 30
slaxemulator@6517 31 -Return the number of bytes written, or if an error occurred, return 0.
slaxemulator@6517 32 +Return the number of characters written, or if an error occurred, return 0.
slaxemulator@6517 33 @end deftypefun
slaxemulator@6517 34
slaxemulator@6517 35 @deftypefun size_t mpfr_inp_str (mpfr_t @var{rop}, FILE *@var{stream}, int @var{base}, mpfr_rnd_t @var{rnd})
slaxemulator@6517 36 diff -Naurd mpfr-3.0.0-a/out_str.c mpfr-3.0.0-b/out_str.c
slaxemulator@6517 37 --- mpfr-3.0.0-a/out_str.c 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 38 +++ mpfr-3.0.0-b/out_str.c 2010-06-23 11:03:12.000000000 +0000
slaxemulator@6517 39 @@ -22,6 +22,16 @@
slaxemulator@6517 40
slaxemulator@6517 41 #include "mpfr-impl.h"
slaxemulator@6517 42
slaxemulator@6517 43 +/* Warning! S should not contain "%". */
slaxemulator@6517 44 +#define OUT_STR_RET(S) \
slaxemulator@6517 45 + do \
slaxemulator@6517 46 + { \
slaxemulator@6517 47 + int r; \
slaxemulator@6517 48 + r = fprintf (stream, (S)); \
slaxemulator@6517 49 + return r < 0 ? 0 : r; \
slaxemulator@6517 50 + } \
slaxemulator@6517 51 + while (0)
slaxemulator@6517 52 +
slaxemulator@6517 53 size_t
slaxemulator@6517 54 mpfr_out_str (FILE *stream, int base, size_t n_digits, mpfr_srcptr op,
slaxemulator@6517 55 mpfr_rnd_t rnd_mode)
slaxemulator@6517 56 @@ -29,6 +39,7 @@
slaxemulator@6517 57 char *s, *s0;
slaxemulator@6517 58 size_t l;
slaxemulator@6517 59 mpfr_exp_t e;
slaxemulator@6517 60 + int err;
slaxemulator@6517 61
slaxemulator@6517 62 MPFR_ASSERTN (base >= 2 && base <= 62);
slaxemulator@6517 63
slaxemulator@6517 64 @@ -36,37 +47,16 @@
slaxemulator@6517 65 if (stream == NULL)
slaxemulator@6517 66 stream = stdout;
slaxemulator@6517 67
slaxemulator@6517 68 - if (MPFR_IS_NAN(op))
slaxemulator@6517 69 - {
slaxemulator@6517 70 - fprintf (stream, "@NaN@");
slaxemulator@6517 71 - return 3;
slaxemulator@6517 72 - }
slaxemulator@6517 73 -
slaxemulator@6517 74 - if (MPFR_IS_INF(op))
slaxemulator@6517 75 - {
slaxemulator@6517 76 - if (MPFR_SIGN(op) > 0)
slaxemulator@6517 77 - {
slaxemulator@6517 78 - fprintf (stream, "@Inf@");
slaxemulator@6517 79 - return 3;
slaxemulator@6517 80 - }
slaxemulator@6517 81 - else
slaxemulator@6517 82 - {
slaxemulator@6517 83 - fprintf (stream, "-@Inf@");
slaxemulator@6517 84 - return 4;
slaxemulator@6517 85 - }
slaxemulator@6517 86 - }
slaxemulator@6517 87 -
slaxemulator@6517 88 - if (MPFR_IS_ZERO(op))
slaxemulator@6517 89 + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (op)))
slaxemulator@6517 90 {
slaxemulator@6517 91 - if (MPFR_SIGN(op) > 0)
slaxemulator@6517 92 - {
slaxemulator@6517 93 - fprintf(stream, "0");
slaxemulator@6517 94 - return 1;
slaxemulator@6517 95 - }
slaxemulator@6517 96 + if (MPFR_IS_NAN (op))
slaxemulator@6517 97 + OUT_STR_RET ("@NaN@");
slaxemulator@6517 98 + else if (MPFR_IS_INF (op))
slaxemulator@6517 99 + OUT_STR_RET (MPFR_IS_POS (op) ? "@Inf@" : "-@Inf@");
slaxemulator@6517 100 else
slaxemulator@6517 101 {
slaxemulator@6517 102 - fprintf(stream, "-0");
slaxemulator@6517 103 - return 2;
slaxemulator@6517 104 + MPFR_ASSERTD (MPFR_IS_ZERO (op));
slaxemulator@6517 105 + OUT_STR_RET (MPFR_IS_POS (op) ? "0" : "-0");
slaxemulator@6517 106 }
slaxemulator@6517 107 }
slaxemulator@6517 108
slaxemulator@6517 109 @@ -77,21 +67,31 @@
slaxemulator@6517 110
slaxemulator@6517 111 l = strlen (s) + 1; /* size of allocated block returned by mpfr_get_str
slaxemulator@6517 112 - may be incorrect, as only an upper bound? */
slaxemulator@6517 113 - if (*s == '-')
slaxemulator@6517 114 - fputc (*s++, stream);
slaxemulator@6517 115
slaxemulator@6517 116 - /* outputs mantissa */
slaxemulator@6517 117 - fputc (*s++, stream); e--; /* leading digit */
slaxemulator@6517 118 - fputc ((unsigned char) MPFR_DECIMAL_POINT, stream);
slaxemulator@6517 119 - fputs (s, stream); /* rest of mantissa */
slaxemulator@6517 120 + /* outputs possible sign and significand */
slaxemulator@6517 121 + err = (*s == '-' && fputc (*s++, stream) == EOF)
slaxemulator@6517 122 + || fputc (*s++, stream) == EOF /* leading digit */
slaxemulator@6517 123 + || fputc ((unsigned char) MPFR_DECIMAL_POINT, stream) == EOF
slaxemulator@6517 124 + || fputs (s, stream) == EOF; /* trailing significand */
slaxemulator@6517 125 (*__gmp_free_func) (s0, l);
slaxemulator@6517 126 + if (MPFR_UNLIKELY (err))
slaxemulator@6517 127 + return 0;
slaxemulator@6517 128 +
slaxemulator@6517 129 + e--; /* due to the leading digit */
slaxemulator@6517 130
slaxemulator@6517 131 /* outputs exponent */
slaxemulator@6517 132 if (e)
slaxemulator@6517 133 {
slaxemulator@6517 134 + int r;
slaxemulator@6517 135 +
slaxemulator@6517 136 MPFR_ASSERTN(e >= LONG_MIN);
slaxemulator@6517 137 MPFR_ASSERTN(e <= LONG_MAX);
slaxemulator@6517 138 - l += fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
slaxemulator@6517 139 +
slaxemulator@6517 140 + r = fprintf (stream, (base <= 10 ? "e%ld" : "@%ld"), (long) e);
slaxemulator@6517 141 + if (MPFR_UNLIKELY (r < 0))
slaxemulator@6517 142 + return 0;
slaxemulator@6517 143 +
slaxemulator@6517 144 + l += r;
slaxemulator@6517 145 }
slaxemulator@6517 146
slaxemulator@6517 147 return l;
slaxemulator@6517 148 diff -Naurd mpfr-3.0.0-a/tests/tout_str.c mpfr-3.0.0-b/tests/tout_str.c
slaxemulator@6517 149 --- mpfr-3.0.0-a/tests/tout_str.c 2010-06-10 11:00:13.000000000 +0000
slaxemulator@6517 150 +++ mpfr-3.0.0-b/tests/tout_str.c 2010-06-23 11:03:12.000000000 +0000
slaxemulator@6517 151 @@ -46,22 +46,54 @@
slaxemulator@6517 152 special (void)
slaxemulator@6517 153 {
slaxemulator@6517 154 mpfr_t x;
slaxemulator@6517 155 + unsigned int n;
slaxemulator@6517 156
slaxemulator@6517 157 mpfr_init (x);
slaxemulator@6517 158
slaxemulator@6517 159 mpfr_set_nan (x);
slaxemulator@6517 160 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 161 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 162 + if (n != 5)
slaxemulator@6517 163 + {
slaxemulator@6517 164 + printf ("Error: mpfr_out_str (file, 10, 0, NaN, MPFR_RNDN) wrote %u "
slaxemulator@6517 165 + "characters instead of 5.\n", n);
slaxemulator@6517 166 + exit (1);
slaxemulator@6517 167 + }
slaxemulator@6517 168
slaxemulator@6517 169 mpfr_set_inf (x, 1);
slaxemulator@6517 170 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 171 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 172 + if (n != 5)
slaxemulator@6517 173 + {
slaxemulator@6517 174 + printf ("Error: mpfr_out_str (file, 10, 0, +Inf, MPFR_RNDN) wrote %u "
slaxemulator@6517 175 + "characters instead of 5.\n", n);
slaxemulator@6517 176 + exit (1);
slaxemulator@6517 177 + }
slaxemulator@6517 178
slaxemulator@6517 179 mpfr_set_inf (x, -1);
slaxemulator@6517 180 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 181 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 182 + if (n != 6)
slaxemulator@6517 183 + {
slaxemulator@6517 184 + printf ("Error: mpfr_out_str (file, 10, 0, -Inf, MPFR_RNDN) wrote %u "
slaxemulator@6517 185 + "characters instead of 6.\n", n);
slaxemulator@6517 186 + exit (1);
slaxemulator@6517 187 + }
slaxemulator@6517 188
slaxemulator@6517 189 mpfr_set_ui (x, 0, MPFR_RNDN);
slaxemulator@6517 190 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 191 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 192 + if (n != 1)
slaxemulator@6517 193 + {
slaxemulator@6517 194 + printf ("Error: mpfr_out_str (file, 10, 0, +0, MPFR_RNDN) wrote %u "
slaxemulator@6517 195 + "characters instead of 1.\n", n);
slaxemulator@6517 196 + exit (1);
slaxemulator@6517 197 + }
slaxemulator@6517 198 +
slaxemulator@6517 199 mpfr_neg (x, x, MPFR_RNDN);
slaxemulator@6517 200 - mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 201 + n = mpfr_out_str (fout, 10, 0, x, MPFR_RNDN);
slaxemulator@6517 202 + if (n != 2)
slaxemulator@6517 203 + {
slaxemulator@6517 204 + printf ("Error: mpfr_out_str (file, 10, 0, -0, MPFR_RNDN) wrote %u "
slaxemulator@6517 205 + "characters instead of 2.\n", n);
slaxemulator@6517 206 + exit (1);
slaxemulator@6517 207 + }
slaxemulator@6517 208
slaxemulator@6517 209 mpfr_clear (x);
slaxemulator@6517 210 }
slaxemulator@6517 211 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
slaxemulator@6517 212 --- mpfr-3.0.0-a/version.c 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 213 +++ mpfr-3.0.0-b/version.c 2010-06-23 11:03:20.000000000 +0000
slaxemulator@6517 214 @@ -25,5 +25,5 @@
slaxemulator@6517 215 const char *
slaxemulator@6517 216 mpfr_get_version (void)
slaxemulator@6517 217 {
slaxemulator@6517 218 - return "3.0.0";
slaxemulator@6517 219 + return "3.0.0-p1";
slaxemulator@6517 220 }
slaxemulator@6517 221 diff -Naurd mpfr-3.0.0-a/Makefile.in mpfr-3.0.0-b/Makefile.in
slaxemulator@6517 222 --- mpfr-3.0.0-a/Makefile.in 2010-06-10 11:00:52.000000000 +0000
slaxemulator@6517 223 +++ mpfr-3.0.0-b/Makefile.in 2010-06-10 11:00:52.000000000 +0000
slaxemulator@6517 224 @@ -239,6 +239,7 @@
slaxemulator@6517 225 distuninstallcheck_listfiles = find . -type f -print
slaxemulator@6517 226 distcleancheck_listfiles = find . -type f -print
slaxemulator@6517 227 ACLOCAL = @ACLOCAL@
slaxemulator@6517 228 +ALLOCA = @ALLOCA@
slaxemulator@6517 229 AMTAR = @AMTAR@
slaxemulator@6517 230 AR = @AR@
slaxemulator@6517 231 AS = @AS@
slaxemulator@6517 232 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
slaxemulator@6517 233 --- mpfr-3.0.0-a/PATCHES 2010-06-23 11:03:36.000000000 +0000
slaxemulator@6517 234 +++ mpfr-3.0.0-b/PATCHES 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 235 @@ -0,0 +1 @@
slaxemulator@6517 236 +alloca
slaxemulator@6517 237 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
slaxemulator@6517 238 --- mpfr-3.0.0-a/VERSION 2010-06-23 11:03:20.000000000 +0000
slaxemulator@6517 239 +++ mpfr-3.0.0-b/VERSION 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 240 @@ -1 +1 @@
slaxemulator@6517 241 -3.0.0-p1
slaxemulator@6517 242 +3.0.0-p2
slaxemulator@6517 243 diff -Naurd mpfr-3.0.0-a/acinclude.m4 mpfr-3.0.0-b/acinclude.m4
slaxemulator@6517 244 --- mpfr-3.0.0-a/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 245 +++ mpfr-3.0.0-b/acinclude.m4 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 246 @@ -59,6 +59,9 @@
slaxemulator@6517 247 dnl sys/fpu.h - MIPS specific
slaxemulator@6517 248 AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
slaxemulator@6517 249
slaxemulator@6517 250 +dnl Check how to get `alloca'
slaxemulator@6517 251 +AC_FUNC_ALLOCA
slaxemulator@6517 252 +
slaxemulator@6517 253 dnl SIZE_MAX macro
slaxemulator@6517 254 gl_SIZE_MAX
slaxemulator@6517 255
slaxemulator@6517 256 diff -Naurd mpfr-3.0.0-a/configure mpfr-3.0.0-b/configure
slaxemulator@6517 257 --- mpfr-3.0.0-a/configure 2010-06-10 11:00:51.000000000 +0000
slaxemulator@6517 258 +++ mpfr-3.0.0-b/configure 2010-06-25 13:23:05.000000000 +0000
slaxemulator@6517 259 @@ -783,6 +783,7 @@
slaxemulator@6517 260 OBJDUMP
slaxemulator@6517 261 DLLTOOL
slaxemulator@6517 262 AS
slaxemulator@6517 263 +ALLOCA
slaxemulator@6517 264 MPFR_LIBM
slaxemulator@6517 265 ANSI2KNR
slaxemulator@6517 266 U
slaxemulator@6517 267 @@ -5622,6 +5623,197 @@
slaxemulator@6517 268 done
slaxemulator@6517 269
slaxemulator@6517 270
slaxemulator@6517 271 +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
slaxemulator@6517 272 +# for constant arguments. Useless!
slaxemulator@6517 273 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
slaxemulator@6517 274 +$as_echo_n "checking for working alloca.h... " >&6; }
slaxemulator@6517 275 +if test "${ac_cv_working_alloca_h+set}" = set; then :
slaxemulator@6517 276 + $as_echo_n "(cached) " >&6
slaxemulator@6517 277 +else
slaxemulator@6517 278 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
slaxemulator@6517 279 +/* end confdefs.h. */
slaxemulator@6517 280 +#include <alloca.h>
slaxemulator@6517 281 +int
slaxemulator@6517 282 +main ()
slaxemulator@6517 283 +{
slaxemulator@6517 284 +char *p = (char *) alloca (2 * sizeof (int));
slaxemulator@6517 285 + if (p) return 0;
slaxemulator@6517 286 + ;
slaxemulator@6517 287 + return 0;
slaxemulator@6517 288 +}
slaxemulator@6517 289 +_ACEOF
slaxemulator@6517 290 +if ac_fn_c_try_link "$LINENO"; then :
slaxemulator@6517 291 + ac_cv_working_alloca_h=yes
slaxemulator@6517 292 +else
slaxemulator@6517 293 + ac_cv_working_alloca_h=no
slaxemulator@6517 294 +fi
slaxemulator@6517 295 +rm -f core conftest.err conftest.$ac_objext \
slaxemulator@6517 296 + conftest$ac_exeext conftest.$ac_ext
slaxemulator@6517 297 +fi
slaxemulator@6517 298 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
slaxemulator@6517 299 +$as_echo "$ac_cv_working_alloca_h" >&6; }
slaxemulator@6517 300 +if test $ac_cv_working_alloca_h = yes; then
slaxemulator@6517 301 +
slaxemulator@6517 302 +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
slaxemulator@6517 303 +
slaxemulator@6517 304 +fi
slaxemulator@6517 305 +
slaxemulator@6517 306 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
slaxemulator@6517 307 +$as_echo_n "checking for alloca... " >&6; }
slaxemulator@6517 308 +if test "${ac_cv_func_alloca_works+set}" = set; then :
slaxemulator@6517 309 + $as_echo_n "(cached) " >&6
slaxemulator@6517 310 +else
slaxemulator@6517 311 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
slaxemulator@6517 312 +/* end confdefs.h. */
slaxemulator@6517 313 +#ifdef __GNUC__
slaxemulator@6517 314 +# define alloca __builtin_alloca
slaxemulator@6517 315 +#else
slaxemulator@6517 316 +# ifdef _MSC_VER
slaxemulator@6517 317 +# include <malloc.h>
slaxemulator@6517 318 +# define alloca _alloca
slaxemulator@6517 319 +# else
slaxemulator@6517 320 +# ifdef HAVE_ALLOCA_H
slaxemulator@6517 321 +# include <alloca.h>
slaxemulator@6517 322 +# else
slaxemulator@6517 323 +# ifdef _AIX
slaxemulator@6517 324 + #pragma alloca
slaxemulator@6517 325 +# else
slaxemulator@6517 326 +# ifndef alloca /* predefined by HP cc +Olibcalls */
slaxemulator@6517 327 +char *alloca ();
slaxemulator@6517 328 +# endif
slaxemulator@6517 329 +# endif
slaxemulator@6517 330 +# endif
slaxemulator@6517 331 +# endif
slaxemulator@6517 332 +#endif
slaxemulator@6517 333 +
slaxemulator@6517 334 +int
slaxemulator@6517 335 +main ()
slaxemulator@6517 336 +{
slaxemulator@6517 337 +char *p = (char *) alloca (1);
slaxemulator@6517 338 + if (p) return 0;
slaxemulator@6517 339 + ;
slaxemulator@6517 340 + return 0;
slaxemulator@6517 341 +}
slaxemulator@6517 342 +_ACEOF
slaxemulator@6517 343 +if ac_fn_c_try_link "$LINENO"; then :
slaxemulator@6517 344 + ac_cv_func_alloca_works=yes
slaxemulator@6517 345 +else
slaxemulator@6517 346 + ac_cv_func_alloca_works=no
slaxemulator@6517 347 +fi
slaxemulator@6517 348 +rm -f core conftest.err conftest.$ac_objext \
slaxemulator@6517 349 + conftest$ac_exeext conftest.$ac_ext
slaxemulator@6517 350 +fi
slaxemulator@6517 351 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
slaxemulator@6517 352 +$as_echo "$ac_cv_func_alloca_works" >&6; }
slaxemulator@6517 353 +
slaxemulator@6517 354 +if test $ac_cv_func_alloca_works = yes; then
slaxemulator@6517 355 +
slaxemulator@6517 356 +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
slaxemulator@6517 357 +
slaxemulator@6517 358 +else
slaxemulator@6517 359 + # The SVR3 libPW and SVR4 libucb both contain incompatible functions
slaxemulator@6517 360 +# that cause trouble. Some versions do not even contain alloca or
slaxemulator@6517 361 +# contain a buggy version. If you still want to use their alloca,
slaxemulator@6517 362 +# use ar to extract alloca.o from them instead of compiling alloca.c.
slaxemulator@6517 363 +
slaxemulator@6517 364 +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
slaxemulator@6517 365 +
slaxemulator@6517 366 +$as_echo "#define C_ALLOCA 1" >>confdefs.h
slaxemulator@6517 367 +
slaxemulator@6517 368 +
slaxemulator@6517 369 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
slaxemulator@6517 370 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
slaxemulator@6517 371 +if test "${ac_cv_os_cray+set}" = set; then :
slaxemulator@6517 372 + $as_echo_n "(cached) " >&6
slaxemulator@6517 373 +else
slaxemulator@6517 374 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
slaxemulator@6517 375 +/* end confdefs.h. */
slaxemulator@6517 376 +#if defined CRAY && ! defined CRAY2
slaxemulator@6517 377 +webecray
slaxemulator@6517 378 +#else
slaxemulator@6517 379 +wenotbecray
slaxemulator@6517 380 +#endif
slaxemulator@6517 381 +
slaxemulator@6517 382 +_ACEOF
slaxemulator@6517 383 +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
slaxemulator@6517 384 + $EGREP "webecray" >/dev/null 2>&1; then :
slaxemulator@6517 385 + ac_cv_os_cray=yes
slaxemulator@6517 386 +else
slaxemulator@6517 387 + ac_cv_os_cray=no
slaxemulator@6517 388 +fi
slaxemulator@6517 389 +rm -f conftest*
slaxemulator@6517 390 +
slaxemulator@6517 391 +fi
slaxemulator@6517 392 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
slaxemulator@6517 393 +$as_echo "$ac_cv_os_cray" >&6; }
slaxemulator@6517 394 +if test $ac_cv_os_cray = yes; then
slaxemulator@6517 395 + for ac_func in _getb67 GETB67 getb67; do
slaxemulator@6517 396 + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
slaxemulator@6517 397 +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
slaxemulator@6517 398 +eval as_val=\$$as_ac_var
slaxemulator@6517 399 + if test "x$as_val" = x""yes; then :
slaxemulator@6517 400 +
slaxemulator@6517 401 +cat >>confdefs.h <<_ACEOF
slaxemulator@6517 402 +#define CRAY_STACKSEG_END $ac_func
slaxemulator@6517 403 +_ACEOF
slaxemulator@6517 404 +
slaxemulator@6517 405 + break
slaxemulator@6517 406 +fi
slaxemulator@6517 407 +
slaxemulator@6517 408 + done
slaxemulator@6517 409 +fi
slaxemulator@6517 410 +
slaxemulator@6517 411 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
slaxemulator@6517 412 +$as_echo_n "checking stack direction for C alloca... " >&6; }
slaxemulator@6517 413 +if test "${ac_cv_c_stack_direction+set}" = set; then :
slaxemulator@6517 414 + $as_echo_n "(cached) " >&6
slaxemulator@6517 415 +else
slaxemulator@6517 416 + if test "$cross_compiling" = yes; then :
slaxemulator@6517 417 + ac_cv_c_stack_direction=0
slaxemulator@6517 418 +else
slaxemulator@6517 419 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext
slaxemulator@6517 420 +/* end confdefs.h. */
slaxemulator@6517 421 +$ac_includes_default
slaxemulator@6517 422 +int
slaxemulator@6517 423 +find_stack_direction ()
slaxemulator@6517 424 +{
slaxemulator@6517 425 + static char *addr = 0;
slaxemulator@6517 426 + auto char dummy;
slaxemulator@6517 427 + if (addr == 0)
slaxemulator@6517 428 + {
slaxemulator@6517 429 + addr = &dummy;
slaxemulator@6517 430 + return find_stack_direction ();
slaxemulator@6517 431 + }
slaxemulator@6517 432 + else
slaxemulator@6517 433 + return (&dummy > addr) ? 1 : -1;
slaxemulator@6517 434 +}
slaxemulator@6517 435 +
slaxemulator@6517 436 +int
slaxemulator@6517 437 +main ()
slaxemulator@6517 438 +{
slaxemulator@6517 439 + return find_stack_direction () < 0;
slaxemulator@6517 440 +}
slaxemulator@6517 441 +_ACEOF
slaxemulator@6517 442 +if ac_fn_c_try_run "$LINENO"; then :
slaxemulator@6517 443 + ac_cv_c_stack_direction=1
slaxemulator@6517 444 +else
slaxemulator@6517 445 + ac_cv_c_stack_direction=-1
slaxemulator@6517 446 +fi
slaxemulator@6517 447 +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
slaxemulator@6517 448 + conftest.$ac_objext conftest.beam conftest.$ac_ext
slaxemulator@6517 449 +fi
slaxemulator@6517 450 +
slaxemulator@6517 451 +fi
slaxemulator@6517 452 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
slaxemulator@6517 453 +$as_echo "$ac_cv_c_stack_direction" >&6; }
slaxemulator@6517 454 +cat >>confdefs.h <<_ACEOF
slaxemulator@6517 455 +#define STACK_DIRECTION $ac_cv_c_stack_direction
slaxemulator@6517 456 +_ACEOF
slaxemulator@6517 457 +
slaxemulator@6517 458 +
slaxemulator@6517 459 +fi
slaxemulator@6517 460 +
slaxemulator@6517 461 +
slaxemulator@6517 462
slaxemulator@6517 463 for ac_header in stdint.h
slaxemulator@6517 464 do :
slaxemulator@6517 465 @@ -7564,13 +7756,13 @@
slaxemulator@6517 466 else
slaxemulator@6517 467 lt_cv_nm_interface="BSD nm"
slaxemulator@6517 468 echo "int some_variable = 0;" > conftest.$ac_ext
slaxemulator@6517 469 - (eval echo "\"\$as_me:7567: $ac_compile\"" >&5)
slaxemulator@6517 470 + (eval echo "\"\$as_me:7759: $ac_compile\"" >&5)
slaxemulator@6517 471 (eval "$ac_compile" 2>conftest.err)
slaxemulator@6517 472 cat conftest.err >&5
slaxemulator@6517 473 - (eval echo "\"\$as_me:7570: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
slaxemulator@6517 474 + (eval echo "\"\$as_me:7762: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
slaxemulator@6517 475 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
slaxemulator@6517 476 cat conftest.err >&5
slaxemulator@6517 477 - (eval echo "\"\$as_me:7573: output\"" >&5)
slaxemulator@6517 478 + (eval echo "\"\$as_me:7765: output\"" >&5)
slaxemulator@6517 479 cat conftest.out >&5
slaxemulator@6517 480 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
slaxemulator@6517 481 lt_cv_nm_interface="MS dumpbin"
slaxemulator@6517 482 @@ -8772,7 +8964,7 @@
slaxemulator@6517 483 ;;
slaxemulator@6517 484 *-*-irix6*)
slaxemulator@6517 485 # Find out which ABI we are using.
slaxemulator@6517 486 - echo '#line 8775 "configure"' > conftest.$ac_ext
slaxemulator@6517 487 + echo '#line 8967 "configure"' > conftest.$ac_ext
slaxemulator@6517 488 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
slaxemulator@6517 489 (eval $ac_compile) 2>&5
slaxemulator@6517 490 ac_status=$?
slaxemulator@6517 491 @@ -10032,11 +10224,11 @@
slaxemulator@6517 492 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
slaxemulator@6517 493 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
slaxemulator@6517 494 -e 's:$: $lt_compiler_flag:'`
slaxemulator@6517 495 - (eval echo "\"\$as_me:10035: $lt_compile\"" >&5)
slaxemulator@6517 496 + (eval echo "\"\$as_me:10227: $lt_compile\"" >&5)
slaxemulator@6517 497 (eval "$lt_compile" 2>conftest.err)
slaxemulator@6517 498 ac_status=$?
slaxemulator@6517 499 cat conftest.err >&5
slaxemulator@6517 500 - echo "$as_me:10039: \$? = $ac_status" >&5
slaxemulator@6517 501 + echo "$as_me:10231: \$? = $ac_status" >&5
slaxemulator@6517 502 if (exit $ac_status) && test -s "$ac_outfile"; then
slaxemulator@6517 503 # The compiler can only warn and ignore the option if not recognized
slaxemulator@6517 504 # So say no if there are warnings other than the usual output.
slaxemulator@6517 505 @@ -10371,11 +10563,11 @@
slaxemulator@6517 506 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
slaxemulator@6517 507 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
slaxemulator@6517 508 -e 's:$: $lt_compiler_flag:'`
slaxemulator@6517 509 - (eval echo "\"\$as_me:10374: $lt_compile\"" >&5)
slaxemulator@6517 510 + (eval echo "\"\$as_me:10566: $lt_compile\"" >&5)
slaxemulator@6517 511 (eval "$lt_compile" 2>conftest.err)
slaxemulator@6517 512 ac_status=$?
slaxemulator@6517 513 cat conftest.err >&5
slaxemulator@6517 514 - echo "$as_me:10378: \$? = $ac_status" >&5
slaxemulator@6517 515 + echo "$as_me:10570: \$? = $ac_status" >&5
slaxemulator@6517 516 if (exit $ac_status) && test -s "$ac_outfile"; then
slaxemulator@6517 517 # The compiler can only warn and ignore the option if not recognized
slaxemulator@6517 518 # So say no if there are warnings other than the usual output.
slaxemulator@6517 519 @@ -10476,11 +10668,11 @@
slaxemulator@6517 520 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
slaxemulator@6517 521 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
slaxemulator@6517 522 -e 's:$: $lt_compiler_flag:'`
slaxemulator@6517 523 - (eval echo "\"\$as_me:10479: $lt_compile\"" >&5)
slaxemulator@6517 524 + (eval echo "\"\$as_me:10671: $lt_compile\"" >&5)
slaxemulator@6517 525 (eval "$lt_compile" 2>out/conftest.err)
slaxemulator@6517 526 ac_status=$?
slaxemulator@6517 527 cat out/conftest.err >&5
slaxemulator@6517 528 - echo "$as_me:10483: \$? = $ac_status" >&5
slaxemulator@6517 529 + echo "$as_me:10675: \$? = $ac_status" >&5
slaxemulator@6517 530 if (exit $ac_status) && test -s out/conftest2.$ac_objext
slaxemulator@6517 531 then
slaxemulator@6517 532 # The compiler can only warn and ignore the option if not recognized
slaxemulator@6517 533 @@ -10531,11 +10723,11 @@
slaxemulator@6517 534 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
slaxemulator@6517 535 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
slaxemulator@6517 536 -e 's:$: $lt_compiler_flag:'`
slaxemulator@6517 537 - (eval echo "\"\$as_me:10534: $lt_compile\"" >&5)
slaxemulator@6517 538 + (eval echo "\"\$as_me:10726: $lt_compile\"" >&5)
slaxemulator@6517 539 (eval "$lt_compile" 2>out/conftest.err)
slaxemulator@6517 540 ac_status=$?
slaxemulator@6517 541 cat out/conftest.err >&5
slaxemulator@6517 542 - echo "$as_me:10538: \$? = $ac_status" >&5
slaxemulator@6517 543 + echo "$as_me:10730: \$? = $ac_status" >&5
slaxemulator@6517 544 if (exit $ac_status) && test -s out/conftest2.$ac_objext
slaxemulator@6517 545 then
slaxemulator@6517 546 # The compiler can only warn and ignore the option if not recognized
slaxemulator@6517 547 @@ -12915,7 +13107,7 @@
slaxemulator@6517 548 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
slaxemulator@6517 549 lt_status=$lt_dlunknown
slaxemulator@6517 550 cat > conftest.$ac_ext <<_LT_EOF
slaxemulator@6517 551 -#line 12918 "configure"
slaxemulator@6517 552 +#line 13110 "configure"
slaxemulator@6517 553 #include "confdefs.h"
slaxemulator@6517 554
slaxemulator@6517 555 #if HAVE_DLFCN_H
slaxemulator@6517 556 @@ -13011,7 +13203,7 @@
slaxemulator@6517 557 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
slaxemulator@6517 558 lt_status=$lt_dlunknown
slaxemulator@6517 559 cat > conftest.$ac_ext <<_LT_EOF
slaxemulator@6517 560 -#line 13014 "configure"
slaxemulator@6517 561 +#line 13206 "configure"
slaxemulator@6517 562 #include "confdefs.h"
slaxemulator@6517 563
slaxemulator@6517 564 #if HAVE_DLFCN_H
slaxemulator@6517 565 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
slaxemulator@6517 566 --- mpfr-3.0.0-a/mpfr.h 2010-06-23 11:03:20.000000000 +0000
slaxemulator@6517 567 +++ mpfr-3.0.0-b/mpfr.h 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 568 @@ -27,7 +27,7 @@
slaxemulator@6517 569 #define MPFR_VERSION_MAJOR 3
slaxemulator@6517 570 #define MPFR_VERSION_MINOR 0
slaxemulator@6517 571 #define MPFR_VERSION_PATCHLEVEL 0
slaxemulator@6517 572 -#define MPFR_VERSION_STRING "3.0.0-p1"
slaxemulator@6517 573 +#define MPFR_VERSION_STRING "3.0.0-p2"
slaxemulator@6517 574
slaxemulator@6517 575 /* Macros dealing with MPFR VERSION */
slaxemulator@6517 576 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
slaxemulator@6517 577 diff -Naurd mpfr-3.0.0-a/tests/Makefile.in mpfr-3.0.0-b/tests/Makefile.in
slaxemulator@6517 578 --- mpfr-3.0.0-a/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
slaxemulator@6517 579 +++ mpfr-3.0.0-b/tests/Makefile.in 2010-06-10 11:00:52.000000000 +0000
slaxemulator@6517 580 @@ -960,6 +960,7 @@
slaxemulator@6517 581 red=; grn=; lgn=; blu=; std=
slaxemulator@6517 582 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
slaxemulator@6517 583 ACLOCAL = @ACLOCAL@
slaxemulator@6517 584 +ALLOCA = @ALLOCA@
slaxemulator@6517 585 AMTAR = @AMTAR@
slaxemulator@6517 586 AR = @AR@
slaxemulator@6517 587 AS = @AS@
slaxemulator@6517 588 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
slaxemulator@6517 589 --- mpfr-3.0.0-a/version.c 2010-06-23 11:03:20.000000000 +0000
slaxemulator@6517 590 +++ mpfr-3.0.0-b/version.c 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 591 @@ -25,5 +25,5 @@
slaxemulator@6517 592 const char *
slaxemulator@6517 593 mpfr_get_version (void)
slaxemulator@6517 594 {
slaxemulator@6517 595 - return "3.0.0-p1";
slaxemulator@6517 596 + return "3.0.0-p2";
slaxemulator@6517 597 }
slaxemulator@6517 598 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
slaxemulator@6517 599 --- mpfr-3.0.0-a/PATCHES 2010-07-10 00:11:19.000000000 +0000
slaxemulator@6517 600 +++ mpfr-3.0.0-b/PATCHES 2010-07-10 00:12:50.000000000 +0000
slaxemulator@6517 601 @@ -0,0 +1 @@
slaxemulator@6517 602 +gamma_underflow
slaxemulator@6517 603 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
slaxemulator@6517 604 --- mpfr-3.0.0-a/VERSION 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 605 +++ mpfr-3.0.0-b/VERSION 2010-07-10 00:11:53.000000000 +0000
slaxemulator@6517 606 @@ -1 +1 @@
slaxemulator@6517 607 -3.0.0-p2
slaxemulator@6517 608 +3.0.0-p3
slaxemulator@6517 609 diff -Naurd mpfr-3.0.0-a/gamma.c mpfr-3.0.0-b/gamma.c
slaxemulator@6517 610 --- mpfr-3.0.0-a/gamma.c 2010-06-10 11:00:14.000000000 +0000
slaxemulator@6517 611 +++ mpfr-3.0.0-b/gamma.c 2010-07-10 00:11:46.000000000 +0000
slaxemulator@6517 612 @@ -274,7 +274,7 @@
slaxemulator@6517 613 /* we want an upper bound for x * [log(2-x)-1].
slaxemulator@6517 614 since x < 0, we need a lower bound on log(2-x) */
slaxemulator@6517 615 mpfr_ui_sub (xp, 2, x, MPFR_RNDD);
slaxemulator@6517 616 - mpfr_log (xp, xp, MPFR_RNDD);
slaxemulator@6517 617 + mpfr_log2 (xp, xp, MPFR_RNDD);
slaxemulator@6517 618 mpfr_sub_ui (xp, xp, 1, MPFR_RNDD);
slaxemulator@6517 619 mpfr_mul (xp, xp, x, MPFR_RNDU);
slaxemulator@6517 620
slaxemulator@6517 621 @@ -303,8 +303,8 @@
slaxemulator@6517 622 {
slaxemulator@6517 623 mpfr_sub (tmp, tmp, tmp2, MPFR_RNDZ); /* low bnd on |sin(Pi*(2-x))| */
slaxemulator@6517 624 mpfr_ui_div (tmp, 12, tmp, MPFR_RNDU); /* upper bound */
slaxemulator@6517 625 - mpfr_log (tmp, tmp, MPFR_RNDU);
slaxemulator@6517 626 - mpfr_add (tmp, tmp, xp, MPFR_RNDU);
slaxemulator@6517 627 + mpfr_log2 (tmp, tmp, MPFR_RNDU);
slaxemulator@6517 628 + mpfr_add (xp, tmp, xp, MPFR_RNDU);
slaxemulator@6517 629 underflow = mpfr_cmp_si (xp, expo.saved_emin - 2) <= 0;
slaxemulator@6517 630 }
slaxemulator@6517 631
slaxemulator@6517 632 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
slaxemulator@6517 633 --- mpfr-3.0.0-a/mpfr.h 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 634 +++ mpfr-3.0.0-b/mpfr.h 2010-07-10 00:11:53.000000000 +0000
slaxemulator@6517 635 @@ -27,7 +27,7 @@
slaxemulator@6517 636 #define MPFR_VERSION_MAJOR 3
slaxemulator@6517 637 #define MPFR_VERSION_MINOR 0
slaxemulator@6517 638 #define MPFR_VERSION_PATCHLEVEL 0
slaxemulator@6517 639 -#define MPFR_VERSION_STRING "3.0.0-p2"
slaxemulator@6517 640 +#define MPFR_VERSION_STRING "3.0.0-p3"
slaxemulator@6517 641
slaxemulator@6517 642 /* Macros dealing with MPFR VERSION */
slaxemulator@6517 643 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
slaxemulator@6517 644 diff -Naurd mpfr-3.0.0-a/tests/tgamma.c mpfr-3.0.0-b/tests/tgamma.c
slaxemulator@6517 645 --- mpfr-3.0.0-a/tests/tgamma.c 2010-06-10 11:00:13.000000000 +0000
slaxemulator@6517 646 +++ mpfr-3.0.0-b/tests/tgamma.c 2010-07-10 00:11:46.000000000 +0000
slaxemulator@6517 647 @@ -461,6 +461,20 @@
slaxemulator@6517 648 mpfr_clear (x);
slaxemulator@6517 649 }
slaxemulator@6517 650
slaxemulator@6517 651 +/* bug found by Stathis, only occurs on 32-bit machines */
slaxemulator@6517 652 +static void
slaxemulator@6517 653 +test20100709 (void)
slaxemulator@6517 654 +{
slaxemulator@6517 655 + mpfr_t x;
slaxemulator@6517 656 + int inex;
slaxemulator@6517 657 +
slaxemulator@6517 658 + mpfr_init2 (x, 100);
slaxemulator@6517 659 + mpfr_set_str (x, "-4.6308260837372266e+07", 10, MPFR_RNDN);
slaxemulator@6517 660 + inex = mpfr_gamma (x, x, MPFR_RNDN);
slaxemulator@6517 661 + MPFR_ASSERTN(MPFR_IS_ZERO(x) && MPFR_IS_NEG(x) && inex > 0);
slaxemulator@6517 662 + mpfr_clear (x);
slaxemulator@6517 663 +}
slaxemulator@6517 664 +
slaxemulator@6517 665 int
slaxemulator@6517 666 main (int argc, char *argv[])
slaxemulator@6517 667 {
slaxemulator@6517 668 @@ -471,6 +485,7 @@
slaxemulator@6517 669 test_generic (2, 100, 2);
slaxemulator@6517 670 gamma_integer ();
slaxemulator@6517 671 test20071231 ();
slaxemulator@6517 672 + test20100709 ();
slaxemulator@6517 673
slaxemulator@6517 674 data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
slaxemulator@6517 675
slaxemulator@6517 676 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
slaxemulator@6517 677 --- mpfr-3.0.0-a/version.c 2010-06-25 13:23:13.000000000 +0000
slaxemulator@6517 678 +++ mpfr-3.0.0-b/version.c 2010-07-10 00:11:53.000000000 +0000
slaxemulator@6517 679 @@ -25,5 +25,5 @@
slaxemulator@6517 680 const char *
slaxemulator@6517 681 mpfr_get_version (void)
slaxemulator@6517 682 {
slaxemulator@6517 683 - return "3.0.0-p2";
slaxemulator@6517 684 + return "3.0.0-p3";
slaxemulator@6517 685 }
slaxemulator@6929 686 diff -Naurd mpfr-3.0.0-a/PATCHES mpfr-3.0.0-b/PATCHES
slaxemulator@6929 687 --- mpfr-3.0.0-a/PATCHES 2010-09-07 08:44:01.000000000 +0000
slaxemulator@6929 688 +++ mpfr-3.0.0-b/PATCHES 2010-09-07 08:48:46.000000000 +0000
slaxemulator@6929 689 @@ -0,0 +1 @@
slaxemulator@6929 690 +mpfr_cmp/set_ui/si
slaxemulator@6929 691 diff -Naurd mpfr-3.0.0-a/VERSION mpfr-3.0.0-b/VERSION
slaxemulator@6929 692 --- mpfr-3.0.0-a/VERSION 2010-07-10 00:11:53.000000000 +0000
slaxemulator@6929 693 +++ mpfr-3.0.0-b/VERSION 2010-09-07 08:46:06.000000000 +0000
slaxemulator@6929 694 @@ -1 +1 @@
slaxemulator@6929 695 -3.0.0-p3
slaxemulator@6929 696 +3.0.0-p4
slaxemulator@6929 697 diff -Naurd mpfr-3.0.0-a/mpfr.h mpfr-3.0.0-b/mpfr.h
slaxemulator@6929 698 --- mpfr-3.0.0-a/mpfr.h 2010-07-10 00:11:53.000000000 +0000
slaxemulator@6929 699 +++ mpfr-3.0.0-b/mpfr.h 2010-09-07 08:46:06.000000000 +0000
slaxemulator@6929 700 @@ -27,7 +27,7 @@
slaxemulator@6929 701 #define MPFR_VERSION_MAJOR 3
slaxemulator@6929 702 #define MPFR_VERSION_MINOR 0
slaxemulator@6929 703 #define MPFR_VERSION_PATCHLEVEL 0
slaxemulator@6929 704 -#define MPFR_VERSION_STRING "3.0.0-p3"
slaxemulator@6929 705 +#define MPFR_VERSION_STRING "3.0.0-p4"
slaxemulator@6929 706
slaxemulator@6929 707 /* Macros dealing with MPFR VERSION */
slaxemulator@6929 708 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
slaxemulator@6929 709 @@ -798,35 +798,45 @@
slaxemulator@6929 710 anyway. Checking with other ICC versions is needed. Possibly detect
slaxemulator@6929 711 whether warnings are produced or not with a configure test.
slaxemulator@6929 712 + Remove C++ too, since it complains too much. */
slaxemulator@6929 713 +/* Added casts to improve robustness in case of undefined behavior and
slaxemulator@6929 714 + compiler extensions based on UB (in particular -fwrapv). MPFR doesn't
slaxemulator@6929 715 + use such extensions, but these macros will be used by 3rd-party code,
slaxemulator@6929 716 + where such extensions may be required.
slaxemulator@6929 717 + Moreover casts to unsigned long have been added to avoid warnings in
slaxemulator@6929 718 + programs that use MPFR and are compiled with -Wconversion; such casts
slaxemulator@6929 719 + are OK since if X is a constant expression, then (unsigned long) X is
slaxemulator@6929 720 + also a constant expression, so that the optimizations still work. */
slaxemulator@6929 721 #if defined (__GNUC__) && !defined(__ICC) && !defined(__cplusplus)
slaxemulator@6929 722 #if (__GNUC__ >= 2)
slaxemulator@6929 723 #undef mpfr_cmp_ui
slaxemulator@6929 724 -/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0. */
slaxemulator@6929 725 -#define mpfr_cmp_ui(_f,_u) \
slaxemulator@6929 726 - (__builtin_constant_p (_u) && (_u) == 0 ? \
slaxemulator@6929 727 - mpfr_sgn (_f) : \
slaxemulator@6929 728 - mpfr_cmp_ui_2exp ((_f),(_u),0))
slaxemulator@6929 729 +/* We use the fact that mpfr_sgn on NaN sets the erange flag and returns 0.
slaxemulator@6929 730 + But warning! mpfr_sgn is specified as a macro in the API, thus the macro
slaxemulator@6929 731 + mustn't be used if side effects are possible, like here. */
slaxemulator@6929 732 +#define mpfr_cmp_ui(_f,_u) \
slaxemulator@6929 733 + (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
slaxemulator@6929 734 + (mpfr_sgn) (_f) : \
slaxemulator@6929 735 + mpfr_cmp_ui_2exp ((_f), (unsigned long) (_u), 0))
slaxemulator@6929 736 #undef mpfr_cmp_si
slaxemulator@6929 737 -#define mpfr_cmp_si(_f,_s) \
slaxemulator@6929 738 - (__builtin_constant_p (_s) && (_s) >= 0 ? \
slaxemulator@6929 739 - mpfr_cmp_ui ((_f), (_s)) : \
slaxemulator@6929 740 - mpfr_cmp_si_2exp ((_f), (_s), 0))
slaxemulator@6929 741 +#define mpfr_cmp_si(_f,_s) \
slaxemulator@6929 742 + (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
slaxemulator@6929 743 + mpfr_cmp_ui ((_f), (unsigned long) (long) (_s)) : \
slaxemulator@6929 744 + mpfr_cmp_si_2exp ((_f), (long) (_s), 0))
slaxemulator@6929 745 #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95
slaxemulator@6929 746 #undef mpfr_set_ui
slaxemulator@6929 747 -#define mpfr_set_ui(_f,_u,_r) \
slaxemulator@6929 748 - (__builtin_constant_p (_u) && (_u) == 0 ? \
slaxemulator@6929 749 - __extension__ ({ \
slaxemulator@6929 750 - mpfr_ptr _p = (_f); \
slaxemulator@6929 751 - _p->_mpfr_sign = 1; \
slaxemulator@6929 752 - _p->_mpfr_exp = __MPFR_EXP_ZERO; \
slaxemulator@6929 753 - (void) (_r); 0; }) : \
slaxemulator@6929 754 - mpfr_set_ui_2exp ((_f), (_u), 0, (_r)))
slaxemulator@6929 755 +#define mpfr_set_ui(_f,_u,_r) \
slaxemulator@6929 756 + (__builtin_constant_p (_u) && (unsigned long) (_u) == 0 ? \
slaxemulator@6929 757 + __extension__ ({ \
slaxemulator@6929 758 + mpfr_ptr _p = (_f); \
slaxemulator@6929 759 + _p->_mpfr_sign = 1; \
slaxemulator@6929 760 + _p->_mpfr_exp = __MPFR_EXP_ZERO; \
slaxemulator@6929 761 + (void) (_r); 0; }) : \
slaxemulator@6929 762 + mpfr_set_ui_2exp ((_f), (unsigned long) (_u), 0, (_r)))
slaxemulator@6929 763 #endif
slaxemulator@6929 764 #undef mpfr_set_si
slaxemulator@6929 765 -#define mpfr_set_si(_f,_s,_r) \
slaxemulator@6929 766 - (__builtin_constant_p (_s) && (_s) >= 0 ? \
slaxemulator@6929 767 - mpfr_set_ui ((_f), (_s), (_r)) : \
slaxemulator@6929 768 - mpfr_set_si_2exp ((_f), (_s), 0, (_r)))
slaxemulator@6929 769 +#define mpfr_set_si(_f,_s,_r) \
slaxemulator@6929 770 + (__builtin_constant_p (_s) && (long) (_s) >= 0 ? \
slaxemulator@6929 771 + mpfr_set_ui ((_f), (unsigned long) (long) (_s), (_r)) : \
slaxemulator@6929 772 + mpfr_set_si_2exp ((_f), (long) (_s), 0, (_r)))
slaxemulator@6929 773 #endif
slaxemulator@6929 774 #endif
slaxemulator@6929 775
slaxemulator@6929 776 diff -Naurd mpfr-3.0.0-a/tests/tcmp_ui.c mpfr-3.0.0-b/tests/tcmp_ui.c
slaxemulator@6929 777 --- mpfr-3.0.0-a/tests/tcmp_ui.c 2010-06-10 11:00:13.000000000 +0000
slaxemulator@6929 778 +++ mpfr-3.0.0-b/tests/tcmp_ui.c 2010-09-07 08:45:12.000000000 +0000
slaxemulator@6929 779 @@ -88,6 +88,126 @@
slaxemulator@6929 780 mpfr_clear (x);
slaxemulator@6929 781 }
slaxemulator@6929 782
slaxemulator@6929 783 +/* Since mpfr_cmp_ui and mpfr_cmp_si are also implemented by a macro
slaxemulator@6929 784 + with __builtin_constant_p for GCC, check that side effects are
slaxemulator@6929 785 + handled correctly. */
slaxemulator@6929 786 +static void
slaxemulator@6929 787 +check_macros (void)
slaxemulator@6929 788 +{
slaxemulator@6929 789 + mpfr_t x;
slaxemulator@6929 790 + int c;
slaxemulator@6929 791 +
slaxemulator@6929 792 + mpfr_init2 (x, 32);
slaxemulator@6929 793 +
slaxemulator@6929 794 + c = 0;
slaxemulator@6929 795 + mpfr_set_ui (x, 17, MPFR_RNDN);
slaxemulator@6929 796 + if (mpfr_cmp_ui (x, 17) != 0)
slaxemulator@6929 797 + {
slaxemulator@6929 798 + printf ("Error 1 on mpfr_cmp_ui(x,17) in check_macros\n");
slaxemulator@6929 799 + exit (1);
slaxemulator@6929 800 + }
slaxemulator@6929 801 + if (mpfr_cmp_ui (x, (c++, 17)) != 0)
slaxemulator@6929 802 + {
slaxemulator@6929 803 + printf ("Error 2 on mpfr_cmp_ui(x,17) in check_macros\n");
slaxemulator@6929 804 + exit (1);
slaxemulator@6929 805 + }
slaxemulator@6929 806 + if (c != 1)
slaxemulator@6929 807 + {
slaxemulator@6929 808 + printf ("Error 3 on mpfr_cmp_ui(x,17) in check_macros\n"
slaxemulator@6929 809 + "(c = %d instead of 1)\n", c);
slaxemulator@6929 810 + exit (1);
slaxemulator@6929 811 + }
slaxemulator@6929 812 + if (mpfr_cmp_si (x, 17) != 0)
slaxemulator@6929 813 + {
slaxemulator@6929 814 + printf ("Error 1 on mpfr_cmp_si(x,17) in check_macros\n");
slaxemulator@6929 815 + exit (1);
slaxemulator@6929 816 + }
slaxemulator@6929 817 + if (mpfr_cmp_si (x, (c++, 17)) != 0)
slaxemulator@6929 818 + {
slaxemulator@6929 819 + printf ("Error 2 on mpfr_cmp_si(x,17) in check_macros\n");
slaxemulator@6929 820 + exit (1);
slaxemulator@6929 821 + }
slaxemulator@6929 822 + if (c != 2)
slaxemulator@6929 823 + {
slaxemulator@6929 824 + printf ("Error 3 on mpfr_cmp_si(x,17) in check_macros\n"
slaxemulator@6929 825 + "(c = %d instead of 2)\n", c);
slaxemulator@6929 826 + exit (1);
slaxemulator@6929 827 + }
slaxemulator@6929 828 +
slaxemulator@6929 829 + c = 0;
slaxemulator@6929 830 + mpfr_set_ui (x, 0, MPFR_RNDN);
slaxemulator@6929 831 + if (mpfr_cmp_ui (x, 0) != 0)
slaxemulator@6929 832 + {
slaxemulator@6929 833 + printf ("Error 1 on mpfr_cmp_ui(x,0) in check_macros\n");
slaxemulator@6929 834 + exit (1);
slaxemulator@6929 835 + }
slaxemulator@6929 836 + if (mpfr_cmp_ui (x, (c++, 0)) != 0)
slaxemulator@6929 837 + {
slaxemulator@6929 838 + printf ("Error 2 on mpfr_cmp_ui(x,0) in check_macros\n");
slaxemulator@6929 839 + exit (1);
slaxemulator@6929 840 + }
slaxemulator@6929 841 + if (c != 1)
slaxemulator@6929 842 + {
slaxemulator@6929 843 + printf ("Error 3 on mpfr_cmp_ui(x,0) in check_macros\n"
slaxemulator@6929 844 + "(c = %d instead of 1)\n", c);
slaxemulator@6929 845 + exit (1);
slaxemulator@6929 846 + }
slaxemulator@6929 847 + if (mpfr_cmp_si (x, 0) != 0)
slaxemulator@6929 848 + {
slaxemulator@6929 849 + printf ("Error 1 on mpfr_cmp_si(x,0) in check_macros\n");
slaxemulator@6929 850 + exit (1);
slaxemulator@6929 851 + }
slaxemulator@6929 852 + if (mpfr_cmp_si (x, (c++, 0)) != 0)
slaxemulator@6929 853 + {
slaxemulator@6929 854 + printf ("Error 2 on mpfr_cmp_si(x,0) in check_macros\n");
slaxemulator@6929 855 + exit (1);
slaxemulator@6929 856 + }
slaxemulator@6929 857 + if (c != 2)
slaxemulator@6929 858 + {
slaxemulator@6929 859 + printf ("Error 3 on mpfr_cmp_si(x,0) in check_macros\n"
slaxemulator@6929 860 + "(c = %d instead of 2)\n", c);
slaxemulator@6929 861 + exit (1);
slaxemulator@6929 862 + }
slaxemulator@6929 863 +
slaxemulator@6929 864 + mpfr_clear (x);
slaxemulator@6929 865 +}
slaxemulator@6929 866 +
slaxemulator@6929 867 +/* Bug in r7114 */
slaxemulator@6929 868 +static void
slaxemulator@6929 869 +test_macros (void)
slaxemulator@6929 870 +{
slaxemulator@6929 871 + mpfr_t x[3];
slaxemulator@6929 872 + mpfr_ptr p;
slaxemulator@6929 873 +
slaxemulator@6929 874 + mpfr_inits (x[0], x[1], x[2], (mpfr_ptr) 0);
slaxemulator@6929 875 + mpfr_set_ui (x[0], 0, MPFR_RNDN);
slaxemulator@6929 876 + p = x[0];
slaxemulator@6929 877 + if (mpfr_cmp_ui (p++, 0) != 0)
slaxemulator@6929 878 + {
slaxemulator@6929 879 + printf ("Error in mpfr_cmp_ui macro: result should be 0.\n");
slaxemulator@6929 880 + exit (1);
slaxemulator@6929 881 + }
slaxemulator@6929 882 + if (p != x[1])
slaxemulator@6929 883 + {
slaxemulator@6929 884 + printf ("Error in mpfr_cmp_ui macro: p - x[0] = %d (expecting 1)\n",
slaxemulator@6929 885 + (int) (p - x[0]));
slaxemulator@6929 886 + exit (1);
slaxemulator@6929 887 + }
slaxemulator@6929 888 + p = x[0];
slaxemulator@6929 889 + if (mpfr_cmp_si (p++, 0) != 0)
slaxemulator@6929 890 + {
slaxemulator@6929 891 + printf ("Error in mpfr_cmp_si macro: result should be 0.\n");
slaxemulator@6929 892 + exit (1);
slaxemulator@6929 893 + }
slaxemulator@6929 894 + if (p != x[1])
slaxemulator@6929 895 + {
slaxemulator@6929 896 + printf ("Error in mpfr_cmp_si macro: p - x[0] = %d (expecting 1)\n",
slaxemulator@6929 897 + (int) (p - x[0]));
slaxemulator@6929 898 + exit (1);
slaxemulator@6929 899 + }
slaxemulator@6929 900 + mpfr_clears (x[0], x[1], x[2], (mpfr_ptr) 0);
slaxemulator@6929 901 +}
slaxemulator@6929 902 +
slaxemulator@6929 903 int
slaxemulator@6929 904 main (void)
slaxemulator@6929 905 {
slaxemulator@6929 906 @@ -216,6 +336,8 @@
slaxemulator@6929 907 mpfr_clear (x);
slaxemulator@6929 908
slaxemulator@6929 909 check_nan ();
slaxemulator@6929 910 + check_macros ();
slaxemulator@6929 911 + test_macros ();
slaxemulator@6929 912
slaxemulator@6929 913 tests_end_mpfr ();
slaxemulator@6929 914 return 0;
slaxemulator@6929 915 diff -Naurd mpfr-3.0.0-a/version.c mpfr-3.0.0-b/version.c
slaxemulator@6929 916 --- mpfr-3.0.0-a/version.c 2010-07-10 00:11:53.000000000 +0000
slaxemulator@6929 917 +++ mpfr-3.0.0-b/version.c 2010-09-07 08:46:06.000000000 +0000
slaxemulator@6929 918 @@ -25,5 +25,5 @@
slaxemulator@6929 919 const char *
slaxemulator@6929 920 mpfr_get_version (void)
slaxemulator@6929 921 {
slaxemulator@6929 922 - return "3.0.0-p3";
slaxemulator@6929 923 + return "3.0.0-p4";
slaxemulator@6929 924 }