| [926fdd5] | 1 | Submitted By: William Harrington (kb0iic at cross-lfs dot org) | 
|---|
|  | 2 | Date: 2017-05-10 | 
|---|
|  | 3 | Initial Package Version: 3.1.5 | 
|---|
|  | 4 | Origin: Upstream | 
|---|
|  | 5 | Upstream Status: Applied | 
|---|
|  | 6 | Description: Contains all upstream patches of mpfr current to patch level 2. | 
|---|
|  | 7 |  | 
|---|
|  | 8 | diff -Naur mpfr-3.1.5.orig/PATCHES mpfr-3.1.5/PATCHES | 
|---|
|  | 9 | --- mpfr-3.1.5.orig/PATCHES     2016-09-27 07:58:15.000000000 +0000 | 
|---|
|  | 10 | +++ mpfr-3.1.5/PATCHES  2017-05-10 23:18:31.760630521 +0000 | 
|---|
|  | 11 | @@ -0,0 +1,2 @@ | 
|---|
|  | 12 | +strtofr | 
|---|
|  | 13 | +vasprintf | 
|---|
|  | 14 | diff -Naur mpfr-3.1.5.orig/VERSION mpfr-3.1.5/VERSION | 
|---|
|  | 15 | --- mpfr-3.1.5.orig/VERSION     2016-09-27 07:58:14.000000000 +0000 | 
|---|
|  | 16 | +++ mpfr-3.1.5/VERSION  2017-05-10 23:18:31.767631412 +0000 | 
|---|
|  | 17 | @@ -1 +1 @@ | 
|---|
|  | 18 | -3.1.5 | 
|---|
|  | 19 | +3.1.5-p2 | 
|---|
|  | 20 | diff -Naur mpfr-3.1.5.orig/src/mpfr.h mpfr-3.1.5/src/mpfr.h | 
|---|
|  | 21 | --- mpfr-3.1.5.orig/src/mpfr.h  2016-09-27 07:58:15.000000000 +0000 | 
|---|
|  | 22 | +++ mpfr-3.1.5/src/mpfr.h       2017-05-10 23:18:31.782633324 +0000 | 
|---|
|  | 23 | @@ -27,7 +27,7 @@ | 
|---|
|  | 24 | #define MPFR_VERSION_MAJOR 3 | 
|---|
|  | 25 | #define MPFR_VERSION_MINOR 1 | 
|---|
|  | 26 | #define MPFR_VERSION_PATCHLEVEL 5 | 
|---|
|  | 27 | -#define MPFR_VERSION_STRING "3.1.5" | 
|---|
|  | 28 | +#define MPFR_VERSION_STRING "3.1.5-p2" | 
|---|
|  | 29 |  | 
|---|
|  | 30 | /* Macros dealing with MPFR VERSION */ | 
|---|
|  | 31 | #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c)) | 
|---|
|  | 32 | diff -Naur mpfr-3.1.5.orig/src/strtofr.c mpfr-3.1.5/src/strtofr.c | 
|---|
|  | 33 | --- mpfr-3.1.5.orig/src/strtofr.c       2016-09-27 07:58:15.000000000 +0000 | 
|---|
|  | 34 | +++ mpfr-3.1.5/src/strtofr.c    2017-05-10 23:18:31.795634980 +0000 | 
|---|
|  | 35 | @@ -743,11 +743,14 @@ | 
|---|
|  | 36 | of the pstr_size most significant digits of pstr->mant, with | 
|---|
|  | 37 | equality in case exact is non-zero. */ | 
|---|
|  | 38 |  | 
|---|
|  | 39 | -      /* test if rounding is possible, and if so exit the loop */ | 
|---|
|  | 40 | -      if (exact || mpfr_can_round_raw (result, ysize, | 
|---|
|  | 41 | -                                       (pstr->negative) ? -1 : 1, | 
|---|
|  | 42 | -                                       ysize_bits - err - 1, | 
|---|
|  | 43 | -                                       MPFR_RNDN, rnd, MPFR_PREC(x))) | 
|---|
|  | 44 | +      /* test if rounding is possible, and if so exit the loop. | 
|---|
|  | 45 | +         Note: we also need to be able to determine the correct ternary value, | 
|---|
|  | 46 | +         thus we use the MPFR_PREC(x) + (rnd == MPFR_RNDN) trick. | 
|---|
|  | 47 | +         For example if result = xxx...xxx111...111 and rnd = RNDN, | 
|---|
|  | 48 | +         then we know the correct rounding is xxx...xx(x+1), but we cannot know | 
|---|
|  | 49 | +         the correct ternary value. */ | 
|---|
|  | 50 | +      if (exact || mpfr_round_p (result, ysize, ysize_bits - err - 1, | 
|---|
|  | 51 | +                                 MPFR_PREC(x) + (rnd == MPFR_RNDN))) | 
|---|
|  | 52 | break; | 
|---|
|  | 53 |  | 
|---|
|  | 54 | next_loop: | 
|---|
|  | 55 | diff -Naur mpfr-3.1.5.orig/src/vasprintf.c mpfr-3.1.5/src/vasprintf.c | 
|---|
|  | 56 | --- mpfr-3.1.5.orig/src/vasprintf.c     2016-09-27 07:58:15.000000000 +0000 | 
|---|
|  | 57 | +++ mpfr-3.1.5/src/vasprintf.c  2017-05-10 23:18:31.741628100 +0000 | 
|---|
|  | 58 | @@ -1593,7 +1593,7 @@ | 
|---|
|  | 59 | } | 
|---|
|  | 60 | else if (spec.spec == 'f' || spec.spec == 'F') | 
|---|
|  | 61 | { | 
|---|
|  | 62 | -          if (spec.prec == -1) | 
|---|
|  | 63 | +          if (spec.prec < 0) | 
|---|
|  | 64 | spec.prec = 6; | 
|---|
|  | 65 | if (regular_fg (np, p, spec, NULL) == -1) | 
|---|
|  | 66 | goto error; | 
|---|
|  | 67 | diff -Naur mpfr-3.1.5.orig/src/version.c mpfr-3.1.5/src/version.c | 
|---|
|  | 68 | --- mpfr-3.1.5.orig/src/version.c       2016-09-27 07:58:15.000000000 +0000 | 
|---|
|  | 69 | +++ mpfr-3.1.5/src/version.c    2017-05-10 23:18:31.806636381 +0000 | 
|---|
|  | 70 | @@ -25,5 +25,5 @@ | 
|---|
|  | 71 | const char * | 
|---|
|  | 72 | mpfr_get_version (void) | 
|---|
|  | 73 | { | 
|---|
|  | 74 | -  return "3.1.5"; | 
|---|
|  | 75 | +  return "3.1.5-p2"; | 
|---|
|  | 76 | } | 
|---|
|  | 77 | diff -Naur mpfr-3.1.5.orig/tests/tsprintf.c mpfr-3.1.5/tests/tsprintf.c | 
|---|
|  | 78 | --- mpfr-3.1.5.orig/tests/tsprintf.c    2016-09-27 07:58:14.000000000 +0000 | 
|---|
|  | 79 | +++ mpfr-3.1.5/tests/tsprintf.c 2017-05-10 23:18:31.754629756 +0000 | 
|---|
|  | 80 | @@ -1251,6 +1251,25 @@ | 
|---|
|  | 81 | check_emin_aux (MPFR_EMIN_MIN); | 
|---|
|  | 82 | } | 
|---|
|  | 83 |  | 
|---|
|  | 84 | +static void | 
|---|
|  | 85 | +test20161214 (void) | 
|---|
|  | 86 | +{ | 
|---|
|  | 87 | +  mpfr_t x; | 
|---|
|  | 88 | +  char buf[32]; | 
|---|
|  | 89 | +  const char s[] = "0x0.fffffffffffff8p+1024"; | 
|---|
|  | 90 | +  int r; | 
|---|
|  | 91 | + | 
|---|
|  | 92 | +  mpfr_init2 (x, 64); | 
|---|
|  | 93 | +  mpfr_set_str (x, s, 16, MPFR_RNDN); | 
|---|
|  | 94 | +  r = mpfr_snprintf (buf, 32, "%.*RDf", -2, x); | 
|---|
|  | 95 | +  MPFR_ASSERTN(r == 316); | 
|---|
|  | 96 | +  r = mpfr_snprintf (buf, 32, "%.*RDf", INT_MIN + 1, x); | 
|---|
|  | 97 | +  MPFR_ASSERTN(r == 316); | 
|---|
|  | 98 | +  r = mpfr_snprintf (buf, 32, "%.*RDf", INT_MIN, x); | 
|---|
|  | 99 | +  MPFR_ASSERTN(r == 316); | 
|---|
|  | 100 | +  mpfr_clear (x); | 
|---|
|  | 101 | +} | 
|---|
|  | 102 | + | 
|---|
|  | 103 | int | 
|---|
|  | 104 | main (int argc, char **argv) | 
|---|
|  | 105 | { | 
|---|
|  | 106 | @@ -1271,6 +1290,7 @@ | 
|---|
|  | 107 | mixed (); | 
|---|
|  | 108 | check_emax (); | 
|---|
|  | 109 | check_emin (); | 
|---|
|  | 110 | +  test20161214 (); | 
|---|
|  | 111 |  | 
|---|
|  | 112 | #if defined(HAVE_LOCALE_H) && defined(HAVE_SETLOCALE) | 
|---|
|  | 113 | #if MPFR_LCONV_DPTS | 
|---|
|  | 114 | diff -Naur mpfr-3.1.5.orig/tests/tstrtofr.c mpfr-3.1.5/tests/tstrtofr.c | 
|---|
|  | 115 | --- mpfr-3.1.5.orig/tests/tstrtofr.c    2016-09-27 07:58:14.000000000 +0000 | 
|---|
|  | 116 | +++ mpfr-3.1.5/tests/tstrtofr.c 2017-05-10 23:18:31.811637019 +0000 | 
|---|
|  | 117 | @@ -1191,6 +1191,24 @@ | 
|---|
|  | 118 | mpfr_clears (e, x1, x2, (mpfr_ptr) 0); | 
|---|
|  | 119 | } | 
|---|
|  | 120 |  | 
|---|
|  | 121 | +/* Note: the number is 5^47/2^9. */ | 
|---|
|  | 122 | +static void | 
|---|
|  | 123 | +bug20161217 (void) | 
|---|
|  | 124 | +{ | 
|---|
|  | 125 | +  mpfr_t fp, z; | 
|---|
|  | 126 | +  static const char * num = "0.1387778780781445675529539585113525390625e31"; | 
|---|
|  | 127 | +  int inex; | 
|---|
|  | 128 | + | 
|---|
|  | 129 | +  mpfr_init2 (fp, 110); | 
|---|
|  | 130 | +  mpfr_init2 (z, 110); | 
|---|
|  | 131 | +  inex = mpfr_strtofr (fp, num, NULL, 10, MPFR_RNDN); | 
|---|
|  | 132 | +  MPFR_ASSERTN(inex == 0); | 
|---|
|  | 133 | +  mpfr_set_str_binary (z, "10001100001000010011110110011101101001010000001011011110010001010100010100100110111101000010001011001100001101E-9"); | 
|---|
|  | 134 | +  MPFR_ASSERTN(mpfr_equal_p (fp, z)); | 
|---|
|  | 135 | +  mpfr_clear (fp); | 
|---|
|  | 136 | +  mpfr_clear (z); | 
|---|
|  | 137 | +} | 
|---|
|  | 138 | + | 
|---|
|  | 139 | int | 
|---|
|  | 140 | main (int argc, char *argv[]) | 
|---|
|  | 141 | { | 
|---|
|  | 142 | @@ -1205,6 +1223,7 @@ | 
|---|
|  | 143 | test20100310 (); | 
|---|
|  | 144 | bug20120814 (); | 
|---|
|  | 145 | bug20120829 (); | 
|---|
|  | 146 | +  bug20161217 (); | 
|---|
|  | 147 |  | 
|---|
|  | 148 | tests_end_mpfr (); | 
|---|
|  | 149 | return 0; | 
|---|