summaryrefslogtreecommitdiff
path: root/src/exp.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2012-02-22 03:53:19 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2012-02-22 03:53:19 +0000
commit89b1f422fad8c50cd46b69748624d312922ef881 (patch)
treedad278625378912197929a89552863c7942f688b /src/exp.c
parent6e9a7ddd09869245d0f46db6493370e0d9a98e54 (diff)
downloadmpfr-89b1f422fad8c50cd46b69748624d312922ef881.tar.gz
Avoid potential integer overflows and improve consistency. This should
fix bug #13918 "Segfault with precision = MPFR_PREC_MAX on 32-bit". Note: this problem appeared in MPFR 3.0.0 when the precision type (now mpfr_prec_t) was changed to a signed integer. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8025 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/exp.c')
-rw-r--r--src/exp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/exp.c b/src/exp.c
index 5fea7c19d..4a0cd3ec1 100644
--- a/src/exp.c
+++ b/src/exp.c
@@ -133,7 +133,7 @@ mpfr_exp (mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd_mode)
mp_size_t yn;
int sh;
- yn = 1 + (MPFR_PREC(y) - 1) / GMP_NUMB_BITS;
+ yn = MPFR_LIMB_SIZE (y);
sh = (mpfr_prec_t) yn * GMP_NUMB_BITS - MPFR_PREC(y);
MPFR_MANT(y)[0] += MPFR_LIMB_ONE << sh;
inexact = 1;