summaryrefslogtreecommitdiff
path: root/src/fits_intmax.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-15 09:39:49 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-02-15 09:39:49 +0000
commitb5162b6851454e841441ced9f15fb6c4817a19ee (patch)
tree29131129c0bc9206339f2a142553e1aab01560b3 /src/fits_intmax.c
parenta25837f27934660d14cebafd945df305b6aeef82 (diff)
downloadmpfr-b5162b6851454e841441ced9f15fb6c4817a19ee.tar.gz
[src/{fits_intmax.c,fits_s.h,fits_u.h}] Fixed mpfr_fits_* functions
in a reduced exponent range and debug mode for non-integer numbers just above the positive limit. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10034 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/fits_intmax.c')
-rw-r--r--src/fits_intmax.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fits_intmax.c b/src/fits_intmax.c
index 3e4a07708..3349a13f0 100644
--- a/src/fits_intmax.c
+++ b/src/fits_intmax.c
@@ -99,7 +99,12 @@ mpfr_fits_intmax_p (mpfr_srcptr f, mpfr_rnd_t rnd)
}
else
{
- res = MPFR_GET_EXP (x) == e;
+ /* Warning! Due to the rounding, x can be an infinity. Here we use
+ the fact that singular numbers have a special exponent field,
+ thus well-defined and different from e, in which case this means
+ that the number does not fit. That's why we use MPFR_EXP, not
+ MPFR_GET_EXP. */
+ res = MPFR_EXP (x) == e;
}
mpfr_clear (x);