summaryrefslogtreecommitdiff
path: root/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c')
-rw-r--r--Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c b/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
index 9c4f27f6a7a..f2f06881383 100644
--- a/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
+++ b/Build/source/libs/mpfr/mpfr-src/src/fits_intmax.c
@@ -21,7 +21,7 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */
#ifdef HAVE_CONFIG_H
-# include "config.h" /* for a build within gmp */
+# include "config.h"
#endif
#include "mpfr-intmax.h"
@@ -29,11 +29,11 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc.,
#ifdef _MPFR_H_HAVE_INTMAX_T
-/* We can't use fits_s.h <= mpfr_cmp_ui */
+/* We can't use fits_s.h as it uses mpfr_cmp_si */
int
mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
{
- unsigned int saved_flags;
+ mpfr_flags_t saved_flags;
mpfr_exp_t e;
int prec;
mpfr_t x, y;
@@ -88,7 +88,9 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
/* hard case: first round to prec bits, then check */
saved_flags = __gmpfr_flags;
mpfr_init2 (x, prec);
- mpfr_set (x, f, rnd);
+ /* for RNDF, it is necessary and sufficient to check it fits when rounding
+ away from zero */
+ mpfr_set (x, f, (rnd == MPFR_RNDF) ? MPFR_RNDA : rnd);
if (neg)
{