source: patches/mpfr-3.1.2-fixes-3.patch@ 7aa6cc3

clfs-3.0.0-sysvinit sysvinit
Last change on this file since 7aa6cc3 was 6eacb8f, checked in by William Harrington <kb0iic@…>, 11 years ago

Update mpfr filename, size, and md5 hash for patch level 8 update from http://www.mpfr.org/mpfr-3.1.2/allpatches

  • Property mode set to 100644
File size: 44.0 KB
  • mpfr-3.1.

    Submitted By: William Harrington (kb0iic at cross-lfs dot org)
    Date: 2014-05-09
    Initial Package Version: 3.1.2
    Origin: Upstream
    Upstream Status: Applied
    Description: Contains all upstream patches of mpfr current to patch level 8.
    
    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1exp_2
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2
     13.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  
    204204          for (k = 0; k < K; k++)
    205205            {
    206206              mpz_mul (ss, ss, ss);
    207               exps <<= 1;
     207              exps *= 2;
    208208              exps += mpz_normalize (ss, ss, q);
    209209            }
    210210          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  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2"
     30#define MPFR_VERSION_STRING "3.1.2-p1"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2";
     28  return "3.1.2-p1";
    2929}
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1fits-smallneg
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2-p1
     13.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  
    3232  int res;
    3333
    3434  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 */
    4336
    4437  e = MPFR_GET_EXP (f);
    4538
     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
    4649  /* first compute prec(MAXIMUM); fits in an int */
    4750  for (s = MAXIMUM, prec = 0; s != 0; s /= 2, prec ++);
    4851
  • 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  
    2727#include "mpfr-intmax.h"
    2828#include "mpfr-impl.h"
    2929
    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". */
    6236
    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
    6638
    67   MPFR_ASSERTD (e == prec);
     39#define FUNCTION   mpfr_fits_uintmax_p
     40#define MAXIMUM    MPFR_UINTMAX_MAX
     41#define TYPE       uintmax_t
    6842
    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"
    7644
    7745#endif
  • src/mpfr.h

    diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
    old new  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p1"
     30#define MPFR_VERSION_STRING "3.1.2-p2"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p1";
     28  return "3.1.2-p2";
    2929}
  • tests/tfits.c

    diff -Naurd mpfr-3.1.2-a/tests/tfits.c mpfr-3.1.2-b/tests/tfits.c
    old new  
    3333#include "mpfr-intmax.h"
    3434#include "mpfr-test.h"
    3535
    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)
    3845
    3946static void check_intmax (void);
    4047
    4148int
    4249main (void)
    4350{
    44   mpfr_t x;
     51  mpfr_t x, y;
     52  int i, r;
    4553
    4654  tests_start_mpfr ();
    4755
    4856  mpfr_init2 (x, 256);
     57  mpfr_init2 (y, 8);
    4958
    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    {
    6461
    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);
    7976
    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);
    9491
    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);
    109106
    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);
    124121
    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);
    143136
    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);
    162155
    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);
    168174
    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    }
    183203
    184204  mpfr_clear (x);
     205  mpfr_clear (y);
    185206
    186207  check_intmax ();
    187208
     
    189210  return 0;
    190211}
    191212
    192 static void check_intmax (void)
     213static void
     214check_intmax (void)
    193215{
    194216#ifdef _MPFR_H_HAVE_INTMAX_T
    195   mpfr_t x;
     217  mpfr_t x, y;
     218  int i, r;
    196219
    197   mpfr_init2 (x, sizeof (uintmax_t)*CHAR_BIT);
     220  mpfr_init2 (x, sizeof (uintmax_t) * CHAR_BIT);
     221  mpfr_init2 (y, 8);
    198222
    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);
    205231
    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);
    212238
    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);
    219245
    220   /* Check small 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);
    226252
    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);
    233259
    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);
    240266
    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);
    262288
    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    }
    269303
    270304  mpfr_clear (x);
     305  mpfr_clear (y);
    271306#endif
    272307}
    273 
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1clang-divby0
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2-p2
     13.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  
    468468#define MPFR_LIMBS_PER_FLT ((IEEE_FLT_MANT_DIG-1)/GMP_NUMB_BITS+1)
    469469
    470470/* 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__)
    473481static double double_zero = 0.0;
    474482# define DBL_NAN (double_zero/double_zero)
    475483# define DBL_POS_INF ((double) 1.0/double_zero)
     
    501509   (with Xcode 2.4.1, i.e. the latest one). */
    502510#define LVALUE(x) (&(x) == &(x) || &(x) != &(x))
    503511#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). */
    504514#ifdef MPFR_NANISNAN
    505515/* Avoid MIPSpro / IRIX64 / gcc -ffast-math (incorrect) optimizations.
    506516   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  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p2"
     30#define MPFR_VERSION_STRING "3.1.2-p3"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p2";
     28  return "3.1.2-p3";
    2929}
  • 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  
    2828main (void)
    2929{
    3030  mpfr_t x, y;
    31   float f, g, infp;
     31  float f, g;
    3232  int i;
     33#if !defined(MPFR_ERRDIVZERO)
     34  float infp;
     35#endif
     36
     37  tests_start_mpfr ();
    3338
     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. */
    3442  infp = (float) DBL_POS_INF;
    3543  if (infp * 0.5 != infp)
    3644    {
     
    3846      fprintf (stderr, "(this is probably a compiler bug, please report)\n");
    3947      exit (1);
    4048    }
    41 
    42   tests_start_mpfr ();
     49#endif
    4350
    4451  mpfr_init2 (x, 24);
    4552  mpfr_init2 (y, 24);
     
    353360      printf ("expected %.8e, got %.8e\n", g, f);
    354361      exit (1);
    355362    }
     363#if !defined(MPFR_ERRDIVZERO)
    356364  f = mpfr_get_flt (x, MPFR_RNDN); /* first round to 2^128 (even rule),
    357365                                      thus we should get +Inf */
    358366  g = infp;
     
    376384      printf ("expected %.8e, got %.8e\n", g, f);
    377385      exit (1);
    378386    }
     387#endif
    379388
    380389  mpfr_clear (x);
    381390  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  
    4747static int
    4848Isnan_ld (long double d)
    4949{
    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))
    5255    return 1;
    5356  LONGDOUBLE_NAN_ACTION (d, goto yes);
    5457  return 0;
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1printf-alt0
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2-p3
     13.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  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p3"
     30#define MPFR_VERSION_STRING "3.1.2-p4"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    10401040}
    10411041
    10421042/* Determine the different parts of the string representation of the regular
    1043    number P when SPEC.SPEC is 'e', 'E', 'g', or 'G'.
     1043   number P when spec.spec is 'e', 'E', 'g', or 'G'.
    10441044   DEC_INFO contains the previously computed exponent and string or is NULL.
    10451045
    10461046   return -1 if some field > INT_MAX */
     
    11671167}
    11681168
    11691169/* Determine the different parts of the string representation of the regular
    1170    number P when SPEC.SPEC is 'f', 'F', 'g', or 'G'.
     1170   number P when spec.spec is 'f', 'F', 'g', or 'G'.
    11711171   DEC_INFO contains the previously computed exponent and string or is NULL.
    11721172
    11731173   return -1 if some field of number_parts is greater than INT_MAX */
     
    15591559            /* fractional part */
    15601560            {
    15611561              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') ?
    15631563                spec.prec - 1 : spec.prec;
    15641564            }
    15651565          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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p3";
     28  return "3.1.2-p4";
    2929}
  • tests/tsprintf.c

    diff -Naurd mpfr-3.1.2-a/tests/tsprintf.c mpfr-3.1.2-b/tests/tsprintf.c
    old new  
    456456  check_sprintf ("1.999900  ", "%-#10.7RG", x);
    457457  check_sprintf ("1.9999    ", "%-10.7RG", x);
    458458  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);
    459462  check_sprintf ("1.00000000000000000000000000000", "%#.30Rg", x);
    460463  check_sprintf ("1", "%.30Rg", x);
    461464  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);
    463469  check_sprintf ("0", "%.30Rg", x);
    464470
    465471  /* 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  
     1custom_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-p4
     13.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  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p4"
     30#define MPFR_VERSION_STRING "3.1.2-p5"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
     
    861861    _t = (mpfr_kind_t) _k;                                     \
    862862    _s = 1;                                                    \
    863863  } else {                                                     \
    864     _t = (mpfr_kind_t) -k;                                     \
     864    _t = (mpfr_kind_t) - _k;                                   \
    865865    _s = -1;                                                   \
    866866  }                                                            \
    867867  _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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p4";
     28  return "3.1.2-p5";
    2929}
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1li2-return
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2-p5
     13.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  
    630630      return mpfr_check_range (y, inexact, rnd_mode);
    631631    }
    632632
    633   MPFR_ASSERTN (0);             /* should never reach this point */
     633  MPFR_RET_NEVER_GO_HERE ();
    634634}
  • src/mpfr.h

    diff -Naurd mpfr-3.1.2-a/src/mpfr.h mpfr-3.1.2-b/src/mpfr.h
    old new  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p5"
     30#define MPFR_VERSION_STRING "3.1.2-p6"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p5";
     28  return "3.1.2-p6";
    2929}
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1exp3
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2-p6
     13.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  
    283283            }
    284284        }
    285285
    286       if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDD, MPFR_RNDZ,
     286      if (mpfr_can_round (shift_x > 0 ? t : tmp, realprec, MPFR_RNDN, MPFR_RNDZ,
    287287                          MPFR_PREC(y) + (rnd_mode == MPFR_RNDN)))
    288288        {
    289289          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  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p6"
     30#define MPFR_VERSION_STRING "3.1.2-p7"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p6";
     28  return "3.1.2-p7";
    2929}
  • tests/texp.c

    diff -Naurd mpfr-3.1.2-a/tests/texp.c mpfr-3.1.2-b/tests/texp.c
    old new  
    150150      exit (1);
    151151    }
    152152
     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
    153169  mpfr_clear (x);
    154170  mpfr_clear (y);
    155171  return 0;
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/PATCHES mpfr-3.1.2-b/PATCHES
    old new  
     1gmp6-compat
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.2-a/VERSION mpfr-3.1.2-b/VERSION
    old new  
    1 3.1.2-p7
     13.1.2-p8
  • configure

    diff -Naurd mpfr-3.1.2-a/configure mpfr-3.1.2-b/configure
    old new  
    1454514545rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
    1454614546fi
    1454714547
    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; }
     14550if test "$cross_compiling" = yes; then :
    1455214551  { $as_echo "$as_me:${as_lineno-$LINENO}: result: can't test" >&5
    1455314552$as_echo "can't test" >&6; }
    1455414553else
    1455514554  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
    1455614555/* end confdefs.h.  */
    1455714556
     14557#include <stdio.h>
    1455814558#include <limits.h>
    1455914559#include "gmp.h"
    14560 #include "gmp-impl.h"
    1456114560
    1456214561int
    1456314562main ()
    1456414563{
    1456514564
    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;
    1456814572
    1456914573  ;
    1457014574  return 0;
     
    1457714581
    1457814582       { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
    1457914583$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.
     14585You probably need to change some of the GMP or MPFR compile options.
     14586See 'config.log' for details (search for GMP_NUMB_BITS)." "$LINENO" 5
    1458214587fi
    1458314588rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
    1458414589  conftest.$ac_objext conftest.beam conftest.$ac_ext
    1458514590fi
    1458614591
    14587 fi
    1458814592
    1458914593
    1459014594if 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  
    435435   ])
    436436fi
    437437
    438 dnl Check for valid GMP_NUMB_BITS and BYTES_PER_MP_LIMB
     438dnl Check for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency.
     439dnl Problems may occur if gmp.h was generated with some ABI
     440dnl and is used with another ABI (or if nails are used).
    439441dnl 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([[
     442AC_MSG_CHECKING(for GMP_NUMB_BITS and sizeof(mp_limb_t) consistency)
     443AC_RUN_IFELSE([AC_LANG_PROGRAM([[
     444#include <stdio.h>
    443445#include <limits.h>
    444446#include "gmp.h"
    445 #include "gmp-impl.h"
    446447]], [[
    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;
    449455]])], [AC_MSG_RESULT(yes)], [
    450456       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.
     458You probably need to change some of the GMP or MPFR compile options.
     459See 'config.log' for details (search for GMP_NUMB_BITS).])],
    453460       [AC_MSG_RESULT([can't test])])
    454 fi
    455461
    456462
    457463dnl 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  
    3030
    3131  /* Check if we can represent the number of limbs
    3232   * 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) );
    3434
    35   /* Check for correct GMP_NUMB_BITS and BYTES_PER_MP_LIMB */
    36   MPFR_ASSERTN( GMP_NUMB_BITS == BYTES_PER_MP_LIMB * CHAR_BIT
    37                 && 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 );
    3838
    3939  MPFR_ASSERTN (mp_bits_per_limb == GMP_NUMB_BITS);
    4040
  • 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  
    7272#endif
    7373
    7474/* Define some macros */
    75 #define BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT)
    7675
    7776#define MP_LIMB_T_MAX (~(mp_limb_t)0)
    7877
     
    9695#define SHRT_HIGHBIT       SHRT_MIN
    9796
    9897/* 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)
    102101#define MPN_COPY(dst,src,n) \
    103102  do                                                                  \
    104103    {                                                                 \
    105104      if ((dst) != (src))                                             \
    106105        {                                                             \
    107106          MPFR_ASSERTD ((char *) (dst) >= (char *) (src) +            \
    108                                           (n) * BYTES_PER_MP_LIMB ||  \
     107                                     (n) * MPFR_BYTES_PER_MP_LIMB ||  \
    109108                        (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);        \
    112111        }                                                             \
    113112    }                                                                 \
    114113  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  
    191191# endif
    192192#endif
    193193
    194 
     194#define MPFR_BYTES_PER_MP_LIMB (GMP_NUMB_BITS/CHAR_BIT)
    195195
    196196/******************************************************
    197197 ******************** Check GMP ***********************
     
    930930#define MPFR_SET_ALLOC_SIZE(x, n) \
    931931 ( ((mp_size_t*) MPFR_MANT(x))[-1] = n)
    932932#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) )
    934934#define MPFR_SET_MANT_PTR(x,p) \
    935935   (MPFR_MANT(x) = (mp_limb_t*) ((mpfr_size_limb_t*) p + 1))
    936936#define MPFR_GET_REAL_PTR(x) \
     
    964964#endif
    965965
    966966#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))
    968968
    969969/* temporary allocate 1 limb at xp, and initialize mpfr variable x */
    970970/* 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  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 2
    30 #define MPFR_VERSION_STRING "3.1.2-p7"
     30#define MPFR_VERSION_STRING "3.1.2-p8"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#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  
    106106  MPFR_ASSERTD(tn <= k);
    107107
    108108  /* 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);
    110110  MPFR_TMP_MARK(marker);
    111111  tmp = MPFR_TMP_LIMBS_ALLOC (k);
    112112
     
    301301  MPFR_ASSERTD (tn <= k); /* tn <= k, thus no int overflow */
    302302
    303303  /* 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);
    305305  MPFR_TMP_MARK (marker);
    306306  tmp = MPFR_TMP_LIMBS_ALLOC (k);
    307307
  • 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  
    2626size_t
    2727mpfr_custom_get_size (mpfr_prec_t prec)
    2828{
    29   return MPFR_PREC2LIMBS (prec) * BYTES_PER_MP_LIMB;
     29  return MPFR_PREC2LIMBS (prec) * MPFR_BYTES_PER_MP_LIMB;
    3030}
    3131
    3232#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  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.2-p7";
     28  return "3.1.2-p8";
    2929}
Note: See TracBrowser for help on using the repository browser.