source:
patches/mpfr-3.1.2-fixes-4.patch@
603873a
Last change on this file since 603873a was b869021, checked in by , 10 years ago | |
---|---|
|
|
File size: 53.6 KB |
-
mpfr-3.1.
Submitted By: William Harrington (kb0iic at cross-lfs dot org) Date: 2014-07-21 Initial Package Version: 3.1.2 Origin: Upstream Upstream Status: Applied Description: Contains all upstream patches of mpfr current to patch level 10. diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 exp_2 -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2 1 3.1.2-p1 -
src/exp_2.c
diff -Naurd mpfr-3.1.2-a/src/exp_2.c mpfr-3.1.2-b/src/exp_2.c
old new 204 204 for (k = 0; k < K; k++) 205 205 { 206 206 mpz_mul (ss, ss, ss); 207 exps <<= 1;207 exps *= 2; 208 208 exps += mpz_normalize (ss, ss, q); 209 209 } 210 210 mpfr_set_z (s, ss, MPFR_RNDN); -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2 "30 #define MPFR_VERSION_STRING "3.1.2-p1" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2 ";28 return "3.1.2-p1"; 29 29 } -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 fits-smallneg -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 11 3.1.2-p2 -
src/fits_u.h
diff -Naurd mpfr-3.1.2-a/src/fits_u.h mpfr-3.1.2-b/src/fits_u.h
old new 32 32 int res; 33 33 34 34 if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) 35 /* Zero always fit */ 36 return MPFR_IS_ZERO (f) ? 1 : 0; 37 else if (MPFR_IS_NEG (f)) 38 /* Negative numbers don't fit */ 39 return 0; 40 /* now it fits if 41 (a) f <= MAXIMUM 42 (b) round(f, prec(slong), rnd) <= MAXIMUM */ 35 return MPFR_IS_ZERO (f) ? 1 : 0; /* Zero always fits */ 43 36 44 37 e = MPFR_GET_EXP (f); 45 38 39 if (MPFR_IS_NEG (f)) 40 return e >= 1 ? 0 /* f <= -1 does not fit */ 41 : rnd != MPFR_RNDN ? MPFR_IS_LIKE_RNDU (rnd, -1) /* directed mode */ 42 : e < 0 ? 1 /* f > -1/2 fits in MPFR_RNDN */ 43 : mpfr_powerof2_raw(f); /* -1/2 fits, -1 < f < -1/2 don't */ 44 45 /* Now it fits if 46 (a) f <= MAXIMUM 47 (b) round(f, prec(slong), rnd) <= MAXIMUM */ 48 46 49 /* first compute prec(MAXIMUM); fits in an int */ 47 50 for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++); 48 51 -
src/fits_uintmax.c
diff -Naurd mpfr-3.1.2-a/src/fits_uintmax.c mpfr-3.1.2-b/src/fits_uintmax.c
old new 27 27 #include "mpfr-intmax.h" 28 28 #include "mpfr-impl.h" 29 29 30 #ifdef _MPFR_H_HAVE_INTMAX_T 31 32 /* We can't use fits_u.h <= mpfr_cmp_ui */ 33 int 34 mpfr_fits_uintmax_p (mpfr_srcptr f, mpfr_rnd_t rnd) 35 { 36 mpfr_exp_t e; 37 int prec; 38 uintmax_t s; 39 mpfr_t x; 40 int res; 41 42 if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (f))) 43 /* Zero always fit */ 44 return MPFR_IS_ZERO (f) ? 1 : 0; 45 else if (MPFR_IS_NEG (f)) 46 /* Negative numbers don't fit */ 47 return 0; 48 /* now it fits if 49 (a) f <= MAXIMUM 50 (b) round(f, prec(slong), rnd) <= MAXIMUM */ 51 52 e = MPFR_GET_EXP (f); 53 54 /* first compute prec(MAXIMUM); fits in an int */ 55 for (s = MPFR_UINTMAX_MAX, prec = 0; s != 0; s /= 2, prec ++); 56 57 /* MAXIMUM needs prec bits, i.e. MAXIMUM = 2^prec - 1 */ 58 59 /* if e <= prec - 1, then f < 2^(prec-1) < MAXIMUM */ 60 if (e <= prec - 1) 61 return 1; 30 /* Note: though mpfr-impl.h is included in fits_u.h, we also include it 31 above so that it gets included even when _MPFR_H_HAVE_INTMAX_T is not 32 defined; this is necessary to avoid an empty translation unit, which 33 is forbidden by ISO C. Without this, a failing test can be reproduced 34 by creating an invalid stdint.h somewhere in the default include path 35 and by compiling MPFR with "gcc -ansi -pedantic-errors". */ 62 36 63 /* if e >= prec + 1, then f >= 2^prec > MAXIMUM */ 64 if (e >= prec + 1) 65 return 0; 37 #ifdef _MPFR_H_HAVE_INTMAX_T 66 38 67 MPFR_ASSERTD (e == prec); 39 #define FUNCTION mpfr_fits_uintmax_p 40 #define MAXIMUM MPFR_UINTMAX_MAX 41 #define TYPE uintmax_t 68 42 69 /* hard case: first round to prec bits, then check */ 70 mpfr_init2 (x, prec); 71 mpfr_set (x, f, rnd); 72 res = MPFR_GET_EXP (x) == e; 73 mpfr_clear (x); 74 return res; 75 } 43 #include "fits_u.h" 76 44 77 45 #endif -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 1"30 #define MPFR_VERSION_STRING "3.1.2-p2" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 1";28 return "3.1.2-p2"; 29 29 } -
tests/tfits.c
diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c
old new 33 33 #include "mpfr-intmax.h" 34 34 #include "mpfr-test.h" 35 35 36 #define ERROR1 { printf("Initial error for x="); mpfr_dump(x); exit(1); } 37 #define ERROR2 { printf("Error for x="); mpfr_dump(x); exit(1); } 36 #define ERROR1(N) \ 37 do \ 38 { \ 39 printf("Error %d for rnd = %s and x = ", N, \ 40 mpfr_print_rnd_mode ((mpfr_rnd_t) r)); \ 41 mpfr_dump(x); \ 42 exit(1); \ 43 } \ 44 while (0) 38 45 39 46 static void check_intmax (void); 40 47 41 48 int 42 49 main (void) 43 50 { 44 mpfr_t x; 51 mpfr_t x, y; 52 int i, r; 45 53 46 54 tests_start_mpfr (); 47 55 48 56 mpfr_init2 (x, 256); 57 mpfr_init2 (y, 8); 49 58 50 /* Check NAN */ 51 mpfr_set_nan (x); 52 if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 53 ERROR1; 54 if (mpfr_fits_slong_p (x, MPFR_RNDN)) 55 ERROR1; 56 if (mpfr_fits_uint_p (x, MPFR_RNDN)) 57 ERROR1; 58 if (mpfr_fits_sint_p (x, MPFR_RNDN)) 59 ERROR1; 60 if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 61 ERROR1; 62 if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 63 ERROR1; 59 RND_LOOP (r) 60 { 64 61 65 /* Check INF*/66 mpfr_set_inf (x, 1);67 if (mpfr_fits_ulong_p (x, MPFR_RNDN))68 ERROR1;69 if (mpfr_fits_slong_p (x, MPFR_RNDN))70 ERROR1;71 if (mpfr_fits_uint_p (x, MPFR_RNDN))72 ERROR1;73 if (mpfr_fits_sint_p (x, MPFR_RNDN))74 ERROR1;75 if (mpfr_fits_ushort_p (x, MPFR_RNDN))76 ERROR1;77 if (mpfr_fits_sshort_p (x, MPFR_RNDN))78 ERROR1;62 /* Check NAN */ 63 mpfr_set_nan (x); 64 if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 65 ERROR1 (1); 66 if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 67 ERROR1 (2); 68 if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 69 ERROR1 (3); 70 if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 71 ERROR1 (4); 72 if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 73 ERROR1 (5); 74 if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 75 ERROR1 (6); 79 76 80 /* Check Zero*/81 MPFR_SET_ZERO (x);82 if (!mpfr_fits_ulong_p (x, MPFR_RNDN))83 ERROR2;84 if (!mpfr_fits_slong_p (x, MPFR_RNDN))85 ERROR2;86 if (!mpfr_fits_uint_p (x, MPFR_RNDN))87 ERROR2;88 if (!mpfr_fits_sint_p (x, MPFR_RNDN))89 ERROR2;90 if (!mpfr_fits_ushort_p (x, MPFR_RNDN))91 ERROR2;92 if (!mpfr_fits_sshort_p (x, MPFR_RNDN))93 ERROR2;77 /* Check INF */ 78 mpfr_set_inf (x, 1); 79 if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 80 ERROR1 (7); 81 if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 82 ERROR1 (8); 83 if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 84 ERROR1 (9); 85 if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 86 ERROR1 (10); 87 if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 88 ERROR1 (11); 89 if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 90 ERROR1 (12); 94 91 95 /* Check small op*/96 mpfr_set_str1 (x, "1@-1");97 if (!mpfr_fits_ulong_p (x, MPFR_RNDN))98 ERROR2;99 if (!mpfr_fits_slong_p (x, MPFR_RNDN))100 ERROR2;101 if (!mpfr_fits_uint_p (x, MPFR_RNDN))102 ERROR2;103 if (!mpfr_fits_sint_p (x, MPFR_RNDN))104 ERROR2;105 if (!mpfr_fits_ushort_p (x, MPFR_RNDN))106 ERROR2;107 if (!mpfr_fits_sshort_p (x, MPFR_RNDN))108 ERROR2;92 /* Check Zero */ 93 MPFR_SET_ZERO (x); 94 if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 95 ERROR1 (13); 96 if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 97 ERROR1 (14); 98 if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 99 ERROR1 (15); 100 if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 101 ERROR1 (16); 102 if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 103 ERROR1 (17); 104 if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 105 ERROR1 (18); 109 106 110 /* Check 17*/111 mpfr_set_ui (x, 17, MPFR_RNDN);112 if (!mpfr_fits_ulong_p (x, MPFR_RNDN))113 ERROR2;114 if (!mpfr_fits_slong_p (x, MPFR_RNDN))115 ERROR2;116 if (!mpfr_fits_uint_p (x, MPFR_RNDN))117 ERROR2;118 if (!mpfr_fits_sint_p (x, MPFR_RNDN))119 ERROR2;120 if (!mpfr_fits_ushort_p (x, MPFR_RNDN))121 ERROR2;122 if (!mpfr_fits_sshort_p (x, MPFR_RNDN))123 ERROR2;107 /* Check small positive op */ 108 mpfr_set_str1 (x, "1@-1"); 109 if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 110 ERROR1 (19); 111 if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 112 ERROR1 (20); 113 if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 114 ERROR1 (21); 115 if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 116 ERROR1 (22); 117 if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 118 ERROR1 (23); 119 if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 120 ERROR1 (24); 124 121 125 /* Check all other values */ 126 mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 127 mpfr_mul_2exp (x, x, 1, MPFR_RNDN); 128 if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 129 ERROR1; 130 if (mpfr_fits_slong_p (x, MPFR_RNDN)) 131 ERROR1; 132 mpfr_mul_2exp (x, x, 40, MPFR_RNDN); 133 if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 134 ERROR1; 135 if (mpfr_fits_uint_p (x, MPFR_RNDN)) 136 ERROR1; 137 if (mpfr_fits_sint_p (x, MPFR_RNDN)) 138 ERROR1; 139 if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 140 ERROR1; 141 if (mpfr_fits_sshort_p (x, MPFR_RNDN)) 142 ERROR1; 122 /* Check 17 */ 123 mpfr_set_ui (x, 17, MPFR_RNDN); 124 if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 125 ERROR1 (25); 126 if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 127 ERROR1 (26); 128 if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 129 ERROR1 (27); 130 if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 131 ERROR1 (28); 132 if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 133 ERROR1 (29); 134 if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 135 ERROR1 (30); 143 136 144 mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN);145 if (!mpfr_fits_ulong_p (x, MPFR_RNDN))146 ERROR2;147 mpfr_set_ui (x, LONG_MAX, MPFR_RNDN);148 if (!mpfr_fits_slong_p (x, MPFR_RNDN))149 ERROR2;150 mpfr_set_ui (x, UINT_MAX, MPFR_RNDN);151 if (!mpfr_fits_uint_p (x, MPFR_RNDN))152 ERROR2;153 mpfr_set_ui (x, INT_MAX, MPFR_RNDN);154 if (!mpfr_fits_sint_p (x, MPFR_RNDN))155 ERROR2;156 mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN);157 if (!mpfr_fits_ushort_p (x, MPFR_RNDN))158 ERROR2;159 mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN);160 if (!mpfr_fits_sshort_p (x, MPFR_RNDN))161 ERROR2;137 /* Check all other values */ 138 mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 139 mpfr_mul_2exp (x, x, 1, MPFR_RNDN); 140 if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 141 ERROR1 (31); 142 if (mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 143 ERROR1 (32); 144 mpfr_mul_2exp (x, x, 40, MPFR_RNDN); 145 if (mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 146 ERROR1 (33); 147 if (mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 148 ERROR1 (34); 149 if (mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 150 ERROR1 (35); 151 if (mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 152 ERROR1 (36); 153 if (mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 154 ERROR1 (37); 162 155 163 mpfr_set_si (x, 1, MPFR_RNDN); 164 if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 165 ERROR2; 166 if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 167 ERROR2; 156 mpfr_set_ui (x, ULONG_MAX, MPFR_RNDN); 157 if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r)) 158 ERROR1 (38); 159 mpfr_set_ui (x, LONG_MAX, MPFR_RNDN); 160 if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 161 ERROR1 (39); 162 mpfr_set_ui (x, UINT_MAX, MPFR_RNDN); 163 if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r)) 164 ERROR1 (40); 165 mpfr_set_ui (x, INT_MAX, MPFR_RNDN); 166 if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 167 ERROR1 (41); 168 mpfr_set_ui (x, USHRT_MAX, MPFR_RNDN); 169 if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r)) 170 ERROR1 (42); 171 mpfr_set_ui (x, SHRT_MAX, MPFR_RNDN); 172 if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 173 ERROR1 (43); 168 174 169 /* Check negative value */ 170 mpfr_set_si (x, -1, MPFR_RNDN); 171 if (!mpfr_fits_sint_p (x, MPFR_RNDN)) 172 ERROR2; 173 if (!mpfr_fits_sshort_p (x, MPFR_RNDN)) 174 ERROR2; 175 if (!mpfr_fits_slong_p (x, MPFR_RNDN)) 176 ERROR2; 177 if (mpfr_fits_uint_p (x, MPFR_RNDN)) 178 ERROR1; 179 if (mpfr_fits_ushort_p (x, MPFR_RNDN)) 180 ERROR1; 181 if (mpfr_fits_ulong_p (x, MPFR_RNDN)) 182 ERROR1; 175 mpfr_set_si (x, 1, MPFR_RNDN); 176 if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 177 ERROR1 (44); 178 if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 179 ERROR1 (45); 180 181 /* Check negative op */ 182 for (i = 1; i <= 4; i++) 183 { 184 int inv; 185 186 mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); 187 mpfr_rint (y, x, (mpfr_rnd_t) r); 188 inv = MPFR_NOTZERO (y); 189 if (!mpfr_fits_ulong_p (x, (mpfr_rnd_t) r) ^ inv) 190 ERROR1 (46); 191 if (!mpfr_fits_slong_p (x, (mpfr_rnd_t) r)) 192 ERROR1 (47); 193 if (!mpfr_fits_uint_p (x, (mpfr_rnd_t) r) ^ inv) 194 ERROR1 (48); 195 if (!mpfr_fits_sint_p (x, (mpfr_rnd_t) r)) 196 ERROR1 (49); 197 if (!mpfr_fits_ushort_p (x, (mpfr_rnd_t) r) ^ inv) 198 ERROR1 (50); 199 if (!mpfr_fits_sshort_p (x, (mpfr_rnd_t) r)) 200 ERROR1 (51); 201 } 202 } 183 203 184 204 mpfr_clear (x); 205 mpfr_clear (y); 185 206 186 207 check_intmax (); 187 208 … … 189 210 return 0; 190 211 } 191 212 192 static void check_intmax (void) 213 static void 214 check_intmax (void) 193 215 { 194 216 #ifdef _MPFR_H_HAVE_INTMAX_T 195 mpfr_t x; 217 mpfr_t x, y; 218 int i, r; 196 219 197 mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT); 220 mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT); 221 mpfr_init2 (y, 8); 198 222 199 /* Check NAN */ 200 mpfr_set_nan (x); 201 if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 202 ERROR1; 203 if (mpfr_fits_intmax_p (x, MPFR_RNDN)) 204 ERROR1; 223 RND_LOOP (r) 224 { 225 /* Check NAN */ 226 mpfr_set_nan (x); 227 if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 228 ERROR1 (52); 229 if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 230 ERROR1 (53); 205 231 206 /* Check INF */207 mpfr_set_inf (x, 1);208 if (mpfr_fits_uintmax_p (x, MPFR_RNDN))209 ERROR1;210 if (mpfr_fits_intmax_p (x, MPFR_RNDN))211 ERROR1;232 /* Check INF */ 233 mpfr_set_inf (x, 1); 234 if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 235 ERROR1 (54); 236 if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 237 ERROR1 (55); 212 238 213 /* Check Zero */214 MPFR_SET_ZERO (x);215 if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))216 ERROR2;217 if (!mpfr_fits_intmax_p (x, MPFR_RNDN))218 ERROR2;239 /* Check Zero */ 240 MPFR_SET_ZERO (x); 241 if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 242 ERROR1 (56); 243 if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 244 ERROR1 (57); 219 245 220 /* Checksmall op */221 mpfr_set_str1 (x, "1@-1");222 if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))223 ERROR2;224 if (!mpfr_fits_intmax_p (x, MPFR_RNDN))225 ERROR2;246 /* Check positive small op */ 247 mpfr_set_str1 (x, "1@-1"); 248 if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 249 ERROR1 (58); 250 if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 251 ERROR1 (59); 226 252 227 /* Check 17 */228 mpfr_set_ui (x, 17, MPFR_RNDN);229 if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))230 ERROR2;231 if (!mpfr_fits_intmax_p (x, MPFR_RNDN))232 ERROR2;253 /* Check 17 */ 254 mpfr_set_ui (x, 17, MPFR_RNDN); 255 if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 256 ERROR1 (60); 257 if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 258 ERROR1 (61); 233 259 234 /* Check hugest */235 mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN);236 if (mpfr_fits_uintmax_p (x, MPFR_RNDN))237 ERROR1;238 if (mpfr_fits_intmax_p (x, MPFR_RNDN))239 ERROR1;260 /* Check hugest */ 261 mpfr_set_ui_2exp (x, 42, sizeof (uintmax_t) * 32, MPFR_RNDN); 262 if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 263 ERROR1 (62); 264 if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 265 ERROR1 (63); 240 266 241 /* Check all other values */242 mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);243 mpfr_add_ui (x, x, 1, MPFR_RNDN);244 if (mpfr_fits_uintmax_p (x, MPFR_RNDN))245 ERROR1;246 mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN);247 if (!mpfr_fits_uintmax_p (x, MPFR_RNDN))248 ERROR2;249 mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);250 mpfr_add_ui (x, x, 1, MPFR_RNDN);251 if (mpfr_fits_intmax_p (x, MPFR_RNDN))252 ERROR1;253 mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN);254 if (!mpfr_fits_intmax_p (x, MPFR_RNDN))255 ERROR2;256 mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN);257 if (!mpfr_fits_intmax_p (x, MPFR_RNDN))258 ERROR2;259 mpfr_sub_ui (x, x, 1, MPFR_RNDN);260 if (mpfr_fits_intmax_p (x, MPFR_RNDN))261 ERROR1;267 /* Check all other values */ 268 mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 269 mpfr_add_ui (x, x, 1, MPFR_RNDN); 270 if (mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 271 ERROR1 (64); 272 mpfr_set_uj (x, MPFR_UINTMAX_MAX, MPFR_RNDN); 273 if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r)) 274 ERROR1 (65); 275 mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 276 mpfr_add_ui (x, x, 1, MPFR_RNDN); 277 if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 278 ERROR1 (66); 279 mpfr_set_sj (x, MPFR_INTMAX_MAX, MPFR_RNDN); 280 if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 281 ERROR1 (67); 282 mpfr_set_sj (x, MPFR_INTMAX_MIN, MPFR_RNDN); 283 if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 284 ERROR1 (68); 285 mpfr_sub_ui (x, x, 1, MPFR_RNDN); 286 if (mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 287 ERROR1 (69); 262 288 263 /* Check negative value */ 264 mpfr_set_si (x, -1, MPFR_RNDN); 265 if (!mpfr_fits_intmax_p (x, MPFR_RNDN)) 266 ERROR2; 267 if (mpfr_fits_uintmax_p (x, MPFR_RNDN)) 268 ERROR1; 289 /* Check negative op */ 290 for (i = 1; i <= 4; i++) 291 { 292 int inv; 293 294 mpfr_set_si_2exp (x, -i, -2, MPFR_RNDN); 295 mpfr_rint (y, x, (mpfr_rnd_t) r); 296 inv = MPFR_NOTZERO (y); 297 if (!mpfr_fits_uintmax_p (x, (mpfr_rnd_t) r) ^ inv) 298 ERROR1 (70); 299 if (!mpfr_fits_intmax_p (x, (mpfr_rnd_t) r)) 300 ERROR1 (71); 301 } 302 } 269 303 270 304 mpfr_clear (x); 305 mpfr_clear (y); 271 306 #endif 272 307 } 273 -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 clang-divby0 -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 21 3.1.2-p3 -
src/mpfr-impl.h
diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h
old new 468 468 #define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1) 469 469 470 470 /* Visual C++ doesn't support +1.0/0.0, -1.0/0.0 and 0.0/0.0 471 at compile time. */ 472 #if defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200) 471 at compile time. 472 Clang with -fsanitize=undefined is a bit similar due to a bug: 473 http://llvm.org/bugs/show_bug.cgi?id=17381 474 but even without its sanitizer, it may be better to use the 475 double_zero version until IEEE 754 division by zero is properly 476 supported: 477 http://llvm.org/bugs/show_bug.cgi?id=17000 478 */ 479 #if (defined(_MSC_VER) && defined(_WIN32) && (_MSC_VER >= 1200)) || \ 480 defined(__clang__) 473 481 static double double_zero = 0.0; 474 482 # define DBL_NAN (double_zero/double_zero) 475 483 # define DBL_POS_INF ((double) 1.0/double_zero) … … 501 509 (with Xcode 2.4.1, i.e. the latest one). */ 502 510 #define LVALUE(x) (&(x) == &(x) || &(x) != &(x)) 503 511 #define DOUBLE_ISINF(x) (LVALUE(x) && ((x) > DBL_MAX || (x) < -DBL_MAX)) 512 /* The DOUBLE_ISNAN(x) macro is also valid on long double x 513 (assuming that the compiler isn't too broken). */ 504 514 #ifdef MPFR_NANISNAN 505 515 /* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations. 506 516 The + must not be replaced by a ||. With gcc -ffast-math, NaN is -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 2"30 #define MPFR_VERSION_STRING "3.1.2-p3" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 2";28 return "3.1.2-p3"; 29 29 } -
tests/tget_flt.c
diff -Naurd mpfr-3.1.2-a/tests/tget_flt.c mpfr-3.1.2-b/tests/tget_flt.c
old new 28 28 main (void) 29 29 { 30 30 mpfr_t x, y; 31 float f, g , infp;31 float f, g; 32 32 int i; 33 #if !defined(MPFR_ERRDIVZERO) 34 float infp; 35 #endif 36 37 tests_start_mpfr (); 33 38 39 #if !defined(MPFR_ERRDIVZERO) 40 /* The definition of DBL_POS_INF involves a division by 0. This makes 41 "clang -O2 -fsanitize=undefined -fno-sanitize-recover" fail. */ 34 42 infp = (float) DBL_POS_INF; 35 43 if (infp * 0.5 != infp) 36 44 { … … 38 46 fprintf (stderr, "(this is probably a compiler bug, please report)\n"); 39 47 exit (1); 40 48 } 41 42 tests_start_mpfr (); 49 #endif 43 50 44 51 mpfr_init2 (x, 24); 45 52 mpfr_init2 (y, 24); … … 353 360 printf ("expected %.8e, got %.8e\n", g, f); 354 361 exit (1); 355 362 } 363 #if !defined(MPFR_ERRDIVZERO) 356 364 f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule), 357 365 thus we should get +Inf */ 358 366 g = infp; … … 376 384 printf ("expected %.8e, got %.8e\n", g, f); 377 385 exit (1); 378 386 } 387 #endif 379 388 380 389 mpfr_clear (x); 381 390 mpfr_clear (y); -
tests/tset_ld.c
diff -Naurd mpfr-3.1.2-a/tests/tset_ld.c mpfr-3.1.2-b/tests/tset_ld.c
old new 47 47 static int 48 48 Isnan_ld (long double d) 49 49 { 50 double e = (double) d; 51 if (DOUBLE_ISNAN (e)) 50 /* Do not convert d to double as this can give an overflow, which 51 may confuse compilers without IEEE 754 support (such as clang 52 -fsanitize=undefined), or trigger a trap if enabled. 53 The DOUBLE_ISNAN macro should work fine on long double. */ 54 if (DOUBLE_ISNAN (d)) 52 55 return 1; 53 56 LONGDOUBLE_NAN_ACTION (d, goto yes); 54 57 return 0; -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 printf-alt0 -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 31 3.1.2-p4 -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 3"30 #define MPFR_VERSION_STRING "3.1.2-p4" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/vasprintf.c
diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c
old new 1040 1040 } 1041 1041 1042 1042 /* Determine the different parts of the string representation of the regular 1043 number P when SPEC.SPECis 'e', 'E', 'g', or 'G'.1043 number P when spec.spec is 'e', 'E', 'g', or 'G'. 1044 1044 DEC_INFO contains the previously computed exponent and string or is NULL. 1045 1045 1046 1046 return -1 if some field > INT_MAX */ … … 1167 1167 } 1168 1168 1169 1169 /* Determine the different parts of the string representation of the regular 1170 number P when SPEC.SPECis 'f', 'F', 'g', or 'G'.1170 number P when spec.spec is 'f', 'F', 'g', or 'G'. 1171 1171 DEC_INFO contains the previously computed exponent and string or is NULL. 1172 1172 1173 1173 return -1 if some field of number_parts is greater than INT_MAX */ … … 1559 1559 /* fractional part */ 1560 1560 { 1561 1561 np->point = MPFR_DECIMAL_POINT; 1562 np->fp_trailing_zeros = (spec.spec == 'g' &&spec.spec == 'G') ?1562 np->fp_trailing_zeros = (spec.spec == 'g' || spec.spec == 'G') ? 1563 1563 spec.prec - 1 : spec.prec; 1564 1564 } 1565 1565 else if (spec.alt) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 3";28 return "3.1.2-p4"; 29 29 } -
tests/tsprintf.c
diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c
old new 456 456 check_sprintf ("1.999900 ", "%-#10.7RG", x); 457 457 check_sprintf ("1.9999 ", "%-10.7RG", x); 458 458 mpfr_set_ui (x, 1, MPFR_RNDN); 459 check_sprintf ("1.", "%#.1Rg", x); 460 check_sprintf ("1. ", "%-#5.1Rg", x); 461 check_sprintf (" 1.0", "%#5.2Rg", x); 459 462 check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x); 460 463 check_sprintf ("1", "%.30Rg", x); 461 464 mpfr_set_ui (x, 0, MPFR_RNDN); 462 check_sprintf ("0.000000000000000000000000000000", "%#.30Rg", x); 465 check_sprintf ("0.", "%#.1Rg", x); 466 check_sprintf ("0. ", "%-#5.1Rg", x); 467 check_sprintf (" 0.0", "%#5.2Rg", x); 468 check_sprintf ("0.00000000000000000000000000000", "%#.30Rg", x); 463 469 check_sprintf ("0", "%.30Rg", x); 464 470 465 471 /* following tests with precision 53 bits */ -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 custom_init_set -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 41 3.1.2-p5 -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 4"30 #define MPFR_VERSION_STRING "3.1.2-p5" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) … … 861 861 _t = (mpfr_kind_t) _k; \ 862 862 _s = 1; \ 863 863 } else { \ 864 _t = (mpfr_kind_t) - k;\864 _t = (mpfr_kind_t) - _k; \ 865 865 _s = -1; \ 866 866 } \ 867 867 _e = _t == MPFR_REGULAR_KIND ? (e) : \ -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 4";28 return "3.1.2-p5"; 29 29 } -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 li2-return -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 51 3.1.2-p6 -
src/li2.c
diff -Naurd mpfr-3.1.2-a/src/li2.c mpfr-3.1.2-b/src/li2.c
old new 630 630 return mpfr_check_range (y, inexact, rnd_mode); 631 631 } 632 632 633 MPFR_ ASSERTN (0); /* should never reach this point */633 MPFR_RET_NEVER_GO_HERE (); 634 634 } -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 5"30 #define MPFR_VERSION_STRING "3.1.2-p6" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 5";28 return "3.1.2-p6"; 29 29 } -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 exp3 -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 61 3.1.2-p7 -
src/exp3.c
diff -Naurd mpfr-3.1.2-a/src/exp3.c mpfr-3.1.2-b/src/exp3.c
old new 283 283 } 284 284 } 285 285 286 if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RND D, MPFR_RNDZ,286 if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDN, MPFR_RNDZ, 287 287 MPFR_PREC(y) + (rnd_mode == MPFR_RNDN))) 288 288 { 289 289 inexact = mpfr_set (y, shift_x > 0 ? t : tmp, rnd_mode); -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 6"30 #define MPFR_VERSION_STRING "3.1.2-p7" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 6";28 return "3.1.2-p7"; 29 29 } -
tests/texp.c
diff -Naurd mpfr-3.1.2-a/tests/texp.c mpfr-3.1.2-b/tests/texp.c
old new 150 150 exit (1); 151 151 } 152 152 153 mpfr_set_prec (x, 118); 154 mpfr_set_str_binary (x, "0.1110010100011101010000111110011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E-86"); 155 mpfr_set_prec (y, 118); 156 mpfr_exp_2 (y, x, MPFR_RNDU); 157 mpfr_exp_3 (x, x, MPFR_RNDU); 158 if (mpfr_cmp (x, y)) 159 { 160 printf ("mpfr_exp_2 and mpfr_exp_3 differ for prec=118\n"); 161 printf ("mpfr_exp_2 gives "); 162 mpfr_out_str (stdout, 2, 0, y, MPFR_RNDN); 163 printf ("\nmpfr_exp_3 gives "); 164 mpfr_out_str (stdout, 2, 0, x, MPFR_RNDN); 165 printf ("\n"); 166 exit (1); 167 } 168 153 169 mpfr_clear (x); 154 170 mpfr_clear (y); 155 171 return 0; -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 gmp6-compat -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 71 3.1.2-p8 -
configure
diff -Naurd mpfr-3.1.2-a/configure mpfr-3.1.2-b/configure
old new 14545 14545 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext 14546 14546 fi 14547 14547 14548 if test "$use_gmp_build" = yes ; then 14549 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for valid GMP_NUMB_BITS" >&5 14550 $as_echo_n "checking for valid GMP_NUMB_BITS... " >&6; } 14551 if test "$cross_compiling" = yes; then : 14548 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency" >&5 14549 $as_echo_n "checking for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency... " >&6; } 14550 if test "$cross_compiling" = yes; then : 14552 14551 { $as_echo "$as_me:${as_lineno-$LINENO}: result: can't test" >&5 14553 14552 $as_echo "can't test" >&6; } 14554 14553 else 14555 14554 cat confdefs.h - <<_ACEOF >conftest.$ac_ext 14556 14555 /* end confdefs.h. */ 14557 14556 14557 #include <stdio.h> 14558 14558 #include <limits.h> 14559 14559 #include "gmp.h" 14560 #include "gmp-impl.h"14561 14560 14562 14561 int 14563 14562 main () 14564 14563 { 14565 14564 14566 return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT 14567 && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; 14565 if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT) 14566 return 0; 14567 fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS); 14568 fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t)); 14569 fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n", 14570 (long) (sizeof(mp_limb_t) * CHAR_BIT)); 14571 return 1; 14568 14572 14569 14573 ; 14570 14574 return 0; … … 14577 14581 14578 14582 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 14579 14583 $as_echo "no" >&6; } 14580 as_fn_error $? "GMP_NUMB_BITS is incorrect. 14581 You probably need to change some of the GMP or MPFR compile options." "$LINENO" 5 14584 as_fn_error $? "GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent. 14585 You probably need to change some of the GMP or MPFR compile options. 14586 See 'config.log' for details (search for GMP_NUMB_BITS)." "$LINENO" 5 14582 14587 fi 14583 14588 rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ 14584 14589 conftest.$ac_objext conftest.beam conftest.$ac_ext 14585 14590 fi 14586 14591 14587 fi14588 14592 14589 14593 14590 14594 if test "$dont_link_with_gmp" = yes ; then -
configure.ac
diff -Naurd mpfr-3.1.2-a/configure.ac mpfr-3.1.2-b/configure.ac
old new 435 435 ]) 436 436 fi 437 437 438 dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB 438 dnl Check for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency. 439 dnl Problems may occur if gmp.h was generated with some ABI 440 dnl and is used with another ABI (or if nails are used). 439 441 dnl This test doesn't need to link with libgmp (at least it shouldn't). 440 if test "$use_gmp_build" = yes ; then 441 AC_MSG_CHECKING(for valid GMP_NUMB_BITS) 442 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 442 AC_MSG_CHECKING(for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency) 443 AC_RUN_IFELSE([AC_LANG_PROGRAM([[ 444 #include <stdio.h> 443 445 #include <limits.h> 444 446 #include "gmp.h" 445 #include "gmp-impl.h"446 447 ]], [[ 447 return GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT 448 && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB ? 0 : 1; 448 if (GMP_NUMB_BITS == sizeof(mp_limb_t) * CHAR_BIT) 449 return 0; 450 fprintf (stderr, "GMP_NUMB_BITS = %ld\n", (long) GMP_NUMB_BITS); 451 fprintf (stderr, "sizeof(mp_limb_t) = %ld\n", (long) sizeof(mp_limb_t)); 452 fprintf (stderr, "sizeof(mp_limb_t) * CHAR_BIT = %ld != GMP_NUMB_BITS\n", 453 (long) (sizeof(mp_limb_t) * CHAR_BIT)); 454 return 1; 449 455 ]])], [AC_MSG_RESULT(yes)], [ 450 456 AC_MSG_RESULT(no) 451 AC_MSG_ERROR([GMP_NUMB_BITS is incorrect. 452 You probably need to change some of the GMP or MPFR compile options.])], 457 AC_MSG_ERROR([GMP_NUMB_BITS and sizeof(mp_limb_t) are not consistent. 458 You probably need to change some of the GMP or MPFR compile options. 459 See 'config.log' for details (search for GMP_NUMB_BITS).])], 453 460 [AC_MSG_RESULT([can't test])]) 454 fi455 461 456 462 457 463 dnl We really need to link using libtool. But it is impossible with the current -
src/init2.c
diff -Naurd mpfr-3.1.2-a/src/init2.c mpfr-3.1.2-b/src/init2.c
old new 30 30 31 31 /* Check if we can represent the number of limbs 32 32 * associated to the maximum of mpfr_prec_t*/ 33 MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/ BYTES_PER_MP_LIMB) );33 MPFR_ASSERTN( MP_SIZE_T_MAX >= (MPFR_PREC_MAX/MPFR_BYTES_PER_MP_LIMB) ); 34 34 35 /* Check for correct GMP_NUMB_BITS and BYTES_PER_MP_LIMB */36 MPFR_ASSERTN( GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT37 && sizeof(mp_limb_t) == BYTES_PER_MP_LIMB );35 /* Check for correct GMP_NUMB_BITS and MPFR_BYTES_PER_MP_LIMB */ 36 MPFR_ASSERTN( GMP_NUMB_BITS == MPFR_BYTES_PER_MP_LIMB * CHAR_BIT 37 && sizeof(mp_limb_t) == MPFR_BYTES_PER_MP_LIMB ); 38 38 39 39 MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS); 40 40 -
src/mpfr-gmp.h
diff -Naurd mpfr-3.1.2-a/src/mpfr-gmp.h mpfr-3.1.2-b/src/mpfr-gmp.h
old new 72 72 #endif 73 73 74 74 /* Define some macros */ 75 #define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT)76 75 77 76 #define MP_LIMB_T_MAX (~(mp_limb_t)0) 78 77 … … 96 95 #define SHRT_HIGHBIT SHRT_MIN 97 96 98 97 /* MP_LIMB macros */ 99 #define MPN_ZERO(dst, n) memset((dst), 0, (n)* BYTES_PER_MP_LIMB)100 #define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)* BYTES_PER_MP_LIMB)101 #define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)* BYTES_PER_MP_LIMB)98 #define MPN_ZERO(dst, n) memset((dst), 0, (n)*MPFR_BYTES_PER_MP_LIMB) 99 #define MPN_COPY_DECR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) 100 #define MPN_COPY_INCR(dst,src,n) memmove((dst),(src),(n)*MPFR_BYTES_PER_MP_LIMB) 102 101 #define MPN_COPY(dst,src,n) \ 103 102 do \ 104 103 { \ 105 104 if ((dst) != (src)) \ 106 105 { \ 107 106 MPFR_ASSERTD ((char *) (dst) >= (char *) (src) + \ 108 (n) *BYTES_PER_MP_LIMB || \107 (n) * MPFR_BYTES_PER_MP_LIMB || \ 109 108 (char *) (src) >= (char *) (dst) + \ 110 (n) *BYTES_PER_MP_LIMB); \111 memcpy ((dst), (src), (n) * BYTES_PER_MP_LIMB);\109 (n) * MPFR_BYTES_PER_MP_LIMB); \ 110 memcpy ((dst), (src), (n) * MPFR_BYTES_PER_MP_LIMB); \ 112 111 } \ 113 112 } \ 114 113 while (0) -
src/mpfr-impl.h
diff -Naurd mpfr-3.1.2-a/src/mpfr-impl.h mpfr-3.1.2-b/src/mpfr-impl.h
old new 191 191 # endif 192 192 #endif 193 193 194 194 #define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT) 195 195 196 196 /****************************************************** 197 197 ******************** Check GMP *********************** … … 930 930 #define MPFR_SET_ALLOC_SIZE(x, n) \ 931 931 ( ((mp_size_t*) MPFR_MANT(x))[-1] = n) 932 932 #define MPFR_MALLOC_SIZE(s) \ 933 ( sizeof(mpfr_size_limb_t) + BYTES_PER_MP_LIMB * ((size_t) s) )933 ( sizeof(mpfr_size_limb_t) + MPFR_BYTES_PER_MP_LIMB * ((size_t) s) ) 934 934 #define MPFR_SET_MANT_PTR(x,p) \ 935 935 (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1)) 936 936 #define MPFR_GET_REAL_PTR(x) \ … … 964 964 #endif 965 965 966 966 #define MPFR_TMP_LIMBS_ALLOC(N) \ 967 ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * BYTES_PER_MP_LIMB))967 ((mp_limb_t *) MPFR_TMP_ALLOC ((size_t) (N) * MPFR_BYTES_PER_MP_LIMB)) 968 968 969 969 /* temporary allocate 1 limb at xp, and initialize mpfr variable x */ 970 970 /* The temporary var doesn't have any size field, but it doesn't matter -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 7"30 #define MPFR_VERSION_STRING "3.1.2-p8" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/mul.c
diff -Naurd mpfr-3.1.2-a/src/mul.c mpfr-3.1.2-b/src/mul.c
old new 106 106 MPFR_ASSERTD(tn <= k); 107 107 108 108 /* Check for no size_t overflow*/ 109 MPFR_ASSERTD((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB);109 MPFR_ASSERTD((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); 110 110 MPFR_TMP_MARK(marker); 111 111 tmp = MPFR_TMP_LIMBS_ALLOC (k); 112 112 … … 301 301 MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */ 302 302 303 303 /* Check for no size_t overflow*/ 304 MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / BYTES_PER_MP_LIMB);304 MPFR_ASSERTD ((size_t) k <= ((size_t) -1) / MPFR_BYTES_PER_MP_LIMB); 305 305 MPFR_TMP_MARK (marker); 306 306 tmp = MPFR_TMP_LIMBS_ALLOC (k); 307 307 -
src/stack_interface.c
diff -Naurd mpfr-3.1.2-a/src/stack_interface.c mpfr-3.1.2-b/src/stack_interface.c
old new 26 26 size_t 27 27 mpfr_custom_get_size (mpfr_prec_t prec) 28 28 { 29 return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB;29 return MPFR_PREC2LIMBS (prec) * MPFR_BYTES_PER_MP_LIMB; 30 30 } 31 31 32 32 #undef mpfr_custom_init -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 7";28 return "3.1.2-p8"; 29 29 } -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 div-overflow -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 81 3.1.2-p9 -
src/div.c
diff -Naurd mpfr-3.1.2-a/src/div.c mpfr-3.1.2-b/src/div.c
old new 750 750 truncate_check_qh: 751 751 if (qh) 752 752 { 753 qexp ++; 753 if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) 754 qexp ++; 755 /* else qexp is now incorrect, but one will still get an overflow */ 754 756 q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; 755 757 } 756 758 goto truncate; … … 765 767 inex = 1; /* always here */ 766 768 if (mpn_add_1 (q0p, q0p, q0size, MPFR_LIMB_ONE << sh)) 767 769 { 768 qexp ++; 770 if (MPFR_LIKELY (qexp < MPFR_EXP_MAX)) 771 qexp ++; 772 /* else qexp is now incorrect, but one will still get an overflow */ 769 773 q0p[q0size - 1] = MPFR_LIMB_HIGHBIT; 770 774 } 771 775 -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 8"30 #define MPFR_VERSION_STRING "3.1.2-p9" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 8";28 return "3.1.2-p9"; 29 29 } -
tests/tdiv.c
diff -Naurd mpfr-3.1.2-a/tests/tdiv.c mpfr-3.1.2-b/tests/tdiv.c
old new 1104 1104 #define RAND_FUNCTION(x) mpfr_random2(x, MPFR_LIMB_SIZE (x), randlimb () % 100, RANDS) 1105 1105 #include "tgeneric.c" 1106 1106 1107 static void 1108 test_extreme (void) 1109 { 1110 mpfr_t x, y, z; 1111 mpfr_exp_t emin, emax; 1112 mpfr_prec_t p[4] = { 8, 32, 64, 256 }; 1113 int xi, yi, zi, j, r; 1114 unsigned int flags, ex_flags; 1115 1116 emin = mpfr_get_emin (); 1117 emax = mpfr_get_emax (); 1118 1119 mpfr_set_emin (MPFR_EMIN_MIN); 1120 mpfr_set_emax (MPFR_EMAX_MAX); 1121 1122 for (xi = 0; xi < 4; xi++) 1123 { 1124 mpfr_init2 (x, p[xi]); 1125 mpfr_setmax (x, MPFR_EMAX_MAX); 1126 MPFR_ASSERTN (mpfr_check (x)); 1127 for (yi = 0; yi < 4; yi++) 1128 { 1129 mpfr_init2 (y, p[yi]); 1130 mpfr_setmin (y, MPFR_EMIN_MIN); 1131 for (j = 0; j < 2; j++) 1132 { 1133 MPFR_ASSERTN (mpfr_check (y)); 1134 for (zi = 0; zi < 4; zi++) 1135 { 1136 mpfr_init2 (z, p[zi]); 1137 RND_LOOP (r) 1138 { 1139 mpfr_clear_flags (); 1140 mpfr_div (z, x, y, (mpfr_rnd_t) r); 1141 flags = __gmpfr_flags; 1142 MPFR_ASSERTN (mpfr_check (z)); 1143 ex_flags = MPFR_FLAGS_OVERFLOW | MPFR_FLAGS_INEXACT; 1144 if (flags != ex_flags) 1145 { 1146 printf ("Bad flags in test_extreme on z = a/b" 1147 " with %s and\n", 1148 mpfr_print_rnd_mode ((mpfr_rnd_t) r)); 1149 printf ("a = "); 1150 mpfr_dump (x); 1151 printf ("b = "); 1152 mpfr_dump (y); 1153 printf ("Expected flags:"); 1154 flags_out (ex_flags); 1155 printf ("Got flags: "); 1156 flags_out (flags); 1157 printf ("z = "); 1158 mpfr_dump (z); 1159 exit (1); 1160 } 1161 mpfr_clear_flags (); 1162 mpfr_div (z, y, x, (mpfr_rnd_t) r); 1163 flags = __gmpfr_flags; 1164 MPFR_ASSERTN (mpfr_check (z)); 1165 ex_flags = MPFR_FLAGS_UNDERFLOW | MPFR_FLAGS_INEXACT; 1166 if (flags != ex_flags) 1167 { 1168 printf ("Bad flags in test_extreme on z = a/b" 1169 " with %s and\n", 1170 mpfr_print_rnd_mode ((mpfr_rnd_t) r)); 1171 printf ("a = "); 1172 mpfr_dump (y); 1173 printf ("b = "); 1174 mpfr_dump (x); 1175 printf ("Expected flags:"); 1176 flags_out (ex_flags); 1177 printf ("Got flags: "); 1178 flags_out (flags); 1179 printf ("z = "); 1180 mpfr_dump (z); 1181 exit (1); 1182 } 1183 } 1184 mpfr_clear (z); 1185 } /* zi */ 1186 mpfr_nextabove (y); 1187 } /* j */ 1188 mpfr_clear (y); 1189 } /* yi */ 1190 mpfr_clear (x); 1191 } /* xi */ 1192 1193 set_emin (emin); 1194 set_emax (emax); 1195 } 1196 1107 1197 int 1108 1198 main (int argc, char *argv[]) 1109 1199 { … … 1130 1220 test_20070603 (); 1131 1221 test_20070628 (); 1132 1222 test_generic (2, 800, 50); 1223 test_extreme (); 1133 1224 1134 1225 tests_end_mpfr (); 1135 1226 return 0; -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
old new 1 vasprintf -
mpfr-3.1.
diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
old new 1 3.1.2-p 91 3.1.2-p10 -
src/mpfr.h
diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
old new 27 27 #define MPFR_VERSION_MAJOR 3 28 28 #define MPFR_VERSION_MINOR 1 29 29 #define MPFR_VERSION_PATCHLEVEL 2 30 #define MPFR_VERSION_STRING "3.1.2-p 9"30 #define MPFR_VERSION_STRING "3.1.2-p10" 31 31 32 32 /* Macros dealing with MPFR VERSION */ 33 33 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) -
src/vasprintf.c
diff -Naurd mpfr-3.1.2-a/src/vasprintf.c mpfr-3.1.2-b/src/vasprintf.c
old new 884 884 first digit, we want the exponent for radix two and the decimal 885 885 point AFTER the first digit. */ 886 886 { 887 MPFR_ASSERTN (exp > MPFR_EMIN_MIN /4); /* possible overflow */ 887 /* An integer overflow is normally not possible since MPFR_EXP_MIN 888 is twice as large as MPFR_EMIN_MIN. */ 889 MPFR_ASSERTN (exp > (MPFR_EXP_MIN + 3) / 4); 888 890 exp = (exp - 1) * 4; 889 891 } 890 892 else 891 893 /* EXP is the exponent for decimal point BEFORE the first digit, we 892 894 want the exponent for decimal point AFTER the first digit. */ 893 895 { 894 MPFR_ASSERTN (exp > MPFR_EMIN_MIN); /* possible overflow */ 896 /* An integer overflow is normally not possible since MPFR_EXP_MIN 897 is twice as large as MPFR_EMIN_MIN. */ 898 MPFR_ASSERTN (exp > MPFR_EXP_MIN); 895 899 --exp; 896 900 } 897 901 } -
src/version.c
diff -Naurd mpfr-3.1.2-a/src/version.c mpfr-3.1.2-b/src/version.c
old new 25 25 const char * 26 26 mpfr_get_version (void) 27 27 { 28 return "3.1.2-p 9";28 return "3.1.2-p10"; 29 29 } -
tests/tsprintf.c
diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c
old new 1184 1184 check_emax_aux (MPFR_EMAX_MAX); 1185 1185 } 1186 1186 1187 static void 1188 check_emin_aux (mpfr_exp_t e) 1189 { 1190 mpfr_t x; 1191 char *s1, s2[256]; 1192 int i; 1193 mpfr_exp_t emin; 1194 mpz_t ee; 1195 1196 MPFR_ASSERTN (e >= LONG_MIN); 1197 emin = mpfr_get_emin (); 1198 set_emin (e); 1199 1200 mpfr_init2 (x, 16); 1201 mpz_init (ee); 1202 1203 mpfr_setmin (x, e); 1204 mpz_set_si (ee, e); 1205 mpz_sub_ui (ee, ee, 1); 1206 1207 i = mpfr_asprintf (&s1, "%Ra", x); 1208 MPFR_ASSERTN (i > 0); 1209 1210 gmp_snprintf (s2, 256, "0x1p%Zd", ee); 1211 1212 if (strcmp (s1, s2) != 0) 1213 { 1214 printf ("Error in check_emin_aux for emin = %ld\n", (long) e); 1215 printf ("Expected %s\n", s2); 1216 printf ("Got %s\n", s1); 1217 exit (1); 1218 } 1219 1220 mpfr_free_str (s1); 1221 1222 i = mpfr_asprintf (&s1, "%Rb", x); 1223 MPFR_ASSERTN (i > 0); 1224 1225 gmp_snprintf (s2, 256, "1p%Zd", ee); 1226 1227 if (strcmp (s1, s2) != 0) 1228 { 1229 printf ("Error in check_emin_aux for emin = %ld\n", (long) e); 1230 printf ("Expected %s\n", s2); 1231 printf ("Got %s\n", s1); 1232 exit (1); 1233 } 1234 1235 mpfr_free_str (s1); 1236 1237 mpfr_clear (x); 1238 mpz_clear (ee); 1239 set_emin (emin); 1240 } 1241 1242 static void 1243 check_emin (void) 1244 { 1245 check_emin_aux (-15); 1246 check_emin_aux (mpfr_get_emin ()); 1247 check_emin_aux (MPFR_EMIN_MIN); 1248 } 1249 1187 1250 int 1188 1251 main (int argc, char **argv) 1189 1252 { … … 1203 1266 decimal (); 1204 1267 mixed (); 1205 1268 check_emax (); 1269 check_emin (); 1206 1270 1207 1271 #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) 1208 1272 locale_da_DK ();
Note:
See TracBrowser
for help on using the repository browser.