diff options
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/exp_2.c')
-rw-r--r-- | Build/source/libs/mpfr/mpfr-src/src/exp_2.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c index 92857ecd827..ebe721057e5 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/exp_2.c +++ b/Build/source/libs/mpfr/mpfr-src/src/exp_2.c @@ -1,7 +1,7 @@ /* mpfr_exp_2 -- exponential of a floating-point number using algorithms in O(n^(1/2)*M(n)) and O(n^(1/3)*M(n)) -Copyright 1999-2019 Free Software Foundation, Inc. +Copyright 1999-2020 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -21,7 +21,7 @@ along with the GNU MPFR Library; see the file COPYING.LESSER. If not, see https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ -#define MPFR_NEED_LONGLONG_H /* for count_leading_zeros */ +#define MPFR_NEED_LONGLONG_H /* MPFR_INT_CEIL_LOG2 */ #include "mpfr-impl.h" static unsigned long @@ -108,7 +108,10 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mp_limb_t r_limb[(sizeof (long) -1) / sizeof(mp_limb_t) + 1]; /* Note: we use precision sizeof (long) * CHAR_BIT - 1 here since it is - more efficient that full limb precision. */ + more efficient that full limb precision. + The value of n will depend on whether MPFR_LONG_WITHIN_LIMB is + defined or not. For instance, for r = 0.111E0, one gets n = 0 + in the former case and n = 1 in the latter case. */ MPFR_TMP_INIT1(r_limb, r, sizeof (long) * CHAR_BIT - 1); mpfr_div (r, x, __gmpfr_const_log2_RNDD, MPFR_RNDN); #ifdef MPFR_LONG_WITHIN_LIMB @@ -116,7 +119,6 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) { mp_limb_t a; mpfr_exp_t exp; - MPFR_STAT_STATIC_ASSERT (MPFR_LIMB_MAX >= ULONG_MAX); /* Read the long directly (faster than using mpfr_get_si since it fits, it is not singular, it can't be zero and there is no conversion to do) */ @@ -144,9 +146,7 @@ mpfr_exp_2 (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode) error_r = 0; else { - count_leading_zeros (error_r, - (mp_limb_t) SAFE_ABS (unsigned long, n) + 1); - error_r = GMP_NUMB_BITS - error_r; + error_r = mpfr_nbits_ulong (SAFE_ABS (unsigned long, n) + 1); /* we have |x| <= 2^error_r * log(2) */ } |