diff options
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c')
-rw-r--r-- | Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c b/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c index 1d2135abc9b..eda94e4c8a2 100644 --- a/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c +++ b/Build/source/libs/mpfr/mpfr-src/src/get_z_exp.c @@ -1,7 +1,7 @@ /* mpfr_get_z_2exp -- get a multiple-precision integer and an exponent from a floating-point number -Copyright 2000-2019 Free Software Foundation, Inc. +Copyright 2000-2020 Free Software Foundation, Inc. Contributed by the AriC and Caramba projects, INRIA. This file is part of the GNU MPFR Library. @@ -39,6 +39,15 @@ https://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., * for consistency. The erange flag is set. */ +/* MPFR_LARGE_EXP can be defined when mpfr_exp_t is guaranteed to have + at least 64 bits (in a portable way). */ +#if GMP_NUMB_BITS >= 64 +/* Now, we know that the constant below is supported by the compiler. */ +# if _MPFR_EXP_FORMAT >= 3 && LONG_MAX >= 9223372036854775807 +# define MPFR_LARGE_EXP 1 +# endif +#endif + mpfr_exp_t mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f) { @@ -70,6 +79,10 @@ mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f) SIZ(z) = MPFR_IS_NEG (f) ? -fn : fn; +#ifndef MPFR_LARGE_EXP + /* If mpfr_exp_t has 64 bits, then MPFR_GET_EXP(f) >= MPFR_EMIN_MIN = 1-2^62 + and MPFR_EXP_MIN <= 1-2^63, thus the following implies PREC(f) > 2^62, + which is impossible due to memory constraints. */ if (MPFR_UNLIKELY ((mpfr_uexp_t) MPFR_GET_EXP (f) - MPFR_EXP_MIN < (mpfr_uexp_t) MPFR_PREC (f))) { @@ -77,6 +90,7 @@ mpfr_get_z_2exp (mpz_ptr z, mpfr_srcptr f) MPFR_SET_ERANGEFLAG (); return MPFR_EXP_MIN; } +#endif return MPFR_GET_EXP (f) - MPFR_PREC (f); } |