[a5d67dc] | 1 | Submitted By: Jim Gifford (jim at cross-lfs dot org) |
---|
| 2 | Date: 2009-04-15 |
---|
| 3 | Initial Package Version: 2.4.1 |
---|
| 4 | Origin: MPFR Website |
---|
| 5 | Upstream Status: Fixed |
---|
| 6 | Description: See http://www.mpfr.org Website Under Bugs |
---|
| 7 | |
---|
| 8 | diff -Naur mpfr-2.4.1.orig/mpfr-gmp.c mpfr-2.4.1/mpfr-gmp.c |
---|
| 9 | --- mpfr-2.4.1.orig/mpfr-gmp.c 2009-02-20 01:43:17.000000000 -0800 |
---|
| 10 | +++ mpfr-2.4.1/mpfr-gmp.c 2009-04-15 08:27:58.199729850 -0700 |
---|
| 11 | @@ -301,7 +301,7 @@ |
---|
| 12 | if (linenum != -1) |
---|
| 13 | fprintf (stderr, "%d: ", linenum); |
---|
| 14 | } |
---|
| 15 | - fprintf (stderr, " assertion failed: %s\n", expr); |
---|
| 16 | + fprintf (stderr, "MPFR assertion failed: %s\n", expr); |
---|
| 17 | abort(); |
---|
| 18 | } |
---|
| 19 | |
---|
| 20 | diff -Naur mpfr-2.4.1.orig/mpfr.h mpfr-2.4.1/mpfr.h |
---|
| 21 | --- mpfr-2.4.1.orig/mpfr.h 2009-02-25 08:16:08.000000000 -0800 |
---|
| 22 | +++ mpfr-2.4.1/mpfr.h 2009-04-15 08:27:58.203729291 -0700 |
---|
| 23 | @@ -27,7 +27,7 @@ |
---|
| 24 | #define MPFR_VERSION_MAJOR 2 |
---|
| 25 | #define MPFR_VERSION_MINOR 4 |
---|
| 26 | #define MPFR_VERSION_PATCHLEVEL 1 |
---|
| 27 | -#define MPFR_VERSION_STRING "2.4.1" |
---|
| 28 | +#define MPFR_VERSION_STRING "2.4.1-p5" |
---|
| 29 | |
---|
| 30 | /* Macros dealing with MPFR VERSION */ |
---|
| 31 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) |
---|
| 32 | diff -Naur mpfr-2.4.1.orig/PATCHES mpfr-2.4.1/PATCHES |
---|
| 33 | --- mpfr-2.4.1.orig/PATCHES 2009-02-20 01:43:17.000000000 -0800 |
---|
| 34 | +++ mpfr-2.4.1/PATCHES 2009-04-15 08:27:58.203729291 -0700 |
---|
| 35 | @@ -0,0 +1,4 @@ |
---|
| 36 | +zeta_ui-shift |
---|
| 37 | +vasprintf-mp_limb_t |
---|
| 38 | +assert |
---|
| 39 | +remainder-neg |
---|
| 40 | diff -Naur mpfr-2.4.1.orig/rem1.c mpfr-2.4.1/rem1.c |
---|
| 41 | --- mpfr-2.4.1.orig/rem1.c 2009-02-20 01:43:17.000000000 -0800 |
---|
| 42 | +++ mpfr-2.4.1/rem1.c 2009-04-15 08:27:58.199729850 -0700 |
---|
| 43 | @@ -170,7 +170,12 @@ |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | if (mpz_cmp_ui (r, 0) == 0) |
---|
| 47 | - inex = mpfr_set_ui (rem, 0, GMP_RNDN); |
---|
| 48 | + { |
---|
| 49 | + inex = mpfr_set_ui (rem, 0, GMP_RNDN); |
---|
| 50 | + /* take into account sign of x */ |
---|
| 51 | + if (signx < 0) |
---|
| 52 | + mpfr_neg (rem, rem, GMP_RNDN); |
---|
| 53 | + } |
---|
| 54 | else |
---|
| 55 | { |
---|
| 56 | if (rnd_q == GMP_RNDN) |
---|
| 57 | @@ -190,6 +195,9 @@ |
---|
| 58 | *quo += 1; |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | + /* take into account sign of x */ |
---|
| 62 | + if (signx < 0) |
---|
| 63 | + mpz_neg (r, r); |
---|
| 64 | inex = mpfr_set_z (rem, r, rnd); |
---|
| 65 | /* if ex > ey, rem should be multiplied by 2^ey, else by 2^ex */ |
---|
| 66 | MPFR_EXP (rem) += (ex > ey) ? ey : ex; |
---|
| 67 | @@ -198,13 +206,6 @@ |
---|
| 68 | if (quo) |
---|
| 69 | *quo *= sign; |
---|
| 70 | |
---|
| 71 | - /* take into account sign of x */ |
---|
| 72 | - if (signx < 0) |
---|
| 73 | - { |
---|
| 74 | - mpfr_neg (rem, rem, GMP_RNDN); |
---|
| 75 | - inex = -inex; |
---|
| 76 | - } |
---|
| 77 | - |
---|
| 78 | mpz_clear (mx); |
---|
| 79 | mpz_clear (my); |
---|
| 80 | mpz_clear (r); |
---|
| 81 | diff -Naur mpfr-2.4.1.orig/tests/tfprintf.c mpfr-2.4.1/tests/tfprintf.c |
---|
| 82 | --- mpfr-2.4.1.orig/tests/tfprintf.c 2009-02-20 01:43:15.000000000 -0800 |
---|
| 83 | +++ mpfr-2.4.1/tests/tfprintf.c 2009-04-15 08:27:58.199729850 -0700 |
---|
| 84 | @@ -195,7 +195,7 @@ |
---|
| 85 | check_vfprintf (fout, "a. %Pu, b. %c, c. %Zi%Zn", prec, ch, mpz, &mpz); |
---|
| 86 | check_length_with_cmp (6, mpz, 17, mpz_cmp_ui (mpz, 17), Zi); |
---|
| 87 | check_vfprintf (fout, "%% a. %#.0RNg, b. %Qx%Rn, c. %p", mpfr, mpq, &mpfr, |
---|
| 88 | - &i); |
---|
| 89 | + (void *) &i); |
---|
| 90 | check_length_with_cmp (7, mpfr, 16, mpfr_cmp_ui (mpfr, 16), Rg); |
---|
| 91 | |
---|
| 92 | #ifndef NPRINTF_T |
---|
| 93 | diff -Naur mpfr-2.4.1.orig/tests/tprintf.c mpfr-2.4.1/tests/tprintf.c |
---|
| 94 | --- mpfr-2.4.1.orig/tests/tprintf.c 2009-02-20 01:43:15.000000000 -0800 |
---|
| 95 | +++ mpfr-2.4.1/tests/tprintf.c 2009-04-15 08:27:58.203729291 -0700 |
---|
| 96 | @@ -191,7 +191,8 @@ |
---|
| 97 | check_length (5, sz, 34, zu); |
---|
| 98 | check_vprintf ("a. %Pu, b. %c, c. %RUG, d. %Zi%Zn", prec, ch, mpfr, mpz, &mpz); |
---|
| 99 | check_length_with_cmp (6, mpz, 24, mpz_cmp_ui (mpz, 24), Zi); |
---|
| 100 | - check_vprintf ("%% a. %#.0RNg, b. %Qx%Rn c. %p", mpfr, mpq, &mpfr, &i); |
---|
| 101 | + check_vprintf ("%% a. %#.0RNg, b. %Qx%Rn c. %p", |
---|
| 102 | + mpfr, mpq, &mpfr, (void *) &i); |
---|
| 103 | check_length_with_cmp (7, mpfr, 16, mpfr_cmp_ui (mpfr, 16), Rg); |
---|
| 104 | |
---|
| 105 | #ifndef NPRINTF_T |
---|
| 106 | diff -Naur mpfr-2.4.1.orig/tests/tremquo.c mpfr-2.4.1/tests/tremquo.c |
---|
| 107 | --- mpfr-2.4.1.orig/tests/tremquo.c 2009-02-20 01:43:15.000000000 -0800 |
---|
| 108 | +++ mpfr-2.4.1/tests/tremquo.c 2009-04-15 08:27:58.199729850 -0700 |
---|
| 109 | @@ -25,6 +25,36 @@ |
---|
| 110 | |
---|
| 111 | #include "mpfr-test.h" |
---|
| 112 | |
---|
| 113 | +static void |
---|
| 114 | +bug20090227 (void) |
---|
| 115 | +{ |
---|
| 116 | + mpfr_t x, y, r1, r2; |
---|
| 117 | + int inex1, inex2; |
---|
| 118 | + |
---|
| 119 | + mpfr_init2 (x, 118); |
---|
| 120 | + mpfr_init2 (y, 181); |
---|
| 121 | + mpfr_init2 (r1, 140); |
---|
| 122 | + mpfr_init2 (r2, 140); |
---|
| 123 | + mpfr_set_si (x, -1, GMP_RNDN); |
---|
| 124 | + mpfr_set_str_binary (y, "1.100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000000011011100000111001101000100101001000000100100111000001000100010100110011111010"); |
---|
| 125 | + inex1 = mpfr_remainder (r1, x, y, GMP_RNDU); |
---|
| 126 | + /* since the quotient is -1, r1 is the rounding of x+y */ |
---|
| 127 | + inex2 = mpfr_add (r2, x, y, GMP_RNDU); |
---|
| 128 | + if (mpfr_cmp (r1, r2)) |
---|
| 129 | + { |
---|
| 130 | + printf ("Error in mpfr_remainder (bug20090227)\n"); |
---|
| 131 | + printf ("Expected "); |
---|
| 132 | + mpfr_dump (r2); |
---|
| 133 | + printf ("Got "); |
---|
| 134 | + mpfr_dump (r1); |
---|
| 135 | + exit (1); |
---|
| 136 | + } |
---|
| 137 | + mpfr_clear (x); |
---|
| 138 | + mpfr_clear (y); |
---|
| 139 | + mpfr_clear (r1); |
---|
| 140 | + mpfr_clear (r2); |
---|
| 141 | +} |
---|
| 142 | + |
---|
| 143 | int |
---|
| 144 | main (int argc, char *argv[]) |
---|
| 145 | { |
---|
| 146 | @@ -50,6 +80,8 @@ |
---|
| 147 | |
---|
| 148 | tests_start_mpfr (); |
---|
| 149 | |
---|
| 150 | + bug20090227 (); |
---|
| 151 | + |
---|
| 152 | mpfr_init (x); |
---|
| 153 | mpfr_init (y); |
---|
| 154 | mpfr_init (r); |
---|
| 155 | diff -Naur mpfr-2.4.1.orig/vasprintf.c mpfr-2.4.1/vasprintf.c |
---|
| 156 | --- mpfr-2.4.1.orig/vasprintf.c 2009-02-20 01:43:17.000000000 -0800 |
---|
| 157 | +++ mpfr-2.4.1/vasprintf.c 2009-04-15 08:27:58.203729291 -0700 |
---|
| 158 | @@ -398,7 +398,7 @@ |
---|
| 159 | (void) va_arg ((ap), mpq_srcptr); \ |
---|
| 160 | break; \ |
---|
| 161 | case MP_LIMB_ARG: \ |
---|
| 162 | - (void) va_arg ((ap), mp_ptr); \ |
---|
| 163 | + (void) va_arg ((ap), mp_limb_t); \ |
---|
| 164 | break; \ |
---|
| 165 | case MP_LIMB_ARRAY_ARG: \ |
---|
| 166 | (void) va_arg ((ap), mp_ptr); \ |
---|
| 167 | diff -Naur mpfr-2.4.1.orig/VERSION mpfr-2.4.1/VERSION |
---|
| 168 | --- mpfr-2.4.1.orig/VERSION 2009-02-25 08:16:08.000000000 -0800 |
---|
| 169 | +++ mpfr-2.4.1/VERSION 2009-04-15 08:27:58.203729291 -0700 |
---|
| 170 | @@ -1 +1 @@ |
---|
| 171 | -2.4.1 |
---|
| 172 | +2.4.1-p5 |
---|
| 173 | diff -Naur mpfr-2.4.1.orig/version.c mpfr-2.4.1/version.c |
---|
| 174 | --- mpfr-2.4.1.orig/version.c 2009-02-25 08:16:08.000000000 -0800 |
---|
| 175 | +++ mpfr-2.4.1/version.c 2009-04-15 08:27:58.203729291 -0700 |
---|
| 176 | @@ -25,5 +25,5 @@ |
---|
| 177 | const char * |
---|
| 178 | mpfr_get_version (void) |
---|
| 179 | { |
---|
| 180 | - return "2.4.1"; |
---|
| 181 | + return "2.4.1-p5"; |
---|
| 182 | } |
---|
| 183 | diff -Naur mpfr-2.4.1.orig/zeta_ui.c mpfr-2.4.1/zeta_ui.c |
---|
| 184 | --- mpfr-2.4.1.orig/zeta_ui.c 2009-02-20 01:43:17.000000000 -0800 |
---|
| 185 | +++ mpfr-2.4.1/zeta_ui.c 2009-04-15 08:27:58.203729291 -0700 |
---|
| 186 | @@ -177,7 +177,9 @@ |
---|
| 187 | mpz_mul_ui (t, t, 2 * k - 1); |
---|
| 188 | } |
---|
| 189 | mpz_div_2exp (t, t, 1); |
---|
| 190 | - if (n < 1UL << (BITS_PER_MP_LIMB / 2)) |
---|
| 191 | + /* Warning: the test below assumes that an unsigned long |
---|
| 192 | + has no padding bits. */ |
---|
| 193 | + if (n < 1UL << ((sizeof(unsigned long) * CHAR_BIT) / 2)) |
---|
| 194 | /* (n - k + 1) * (n + k - 1) < n^2 */ |
---|
| 195 | mpz_divexact_ui (t, t, (n - k + 1) * (n + k - 1)); |
---|
| 196 | else |
---|