summaryrefslogtreecommitdiff
path: root/exp3.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-06-08 07:27:40 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-06-08 07:27:40 +0000
commit21b6958851c2478517cb09a215205ed336ea7f49 (patch)
treea946f24c787d652f11d8cc0367f54edd8b5ad8ca /exp3.c
parente9246d100550280d64895300c755a579e83400a8 (diff)
downloadmpfr-21b6958851c2478517cb09a215205ed336ea7f49.tar.gz
fixed bug in mpfr_exp_3 (wrong assert)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2921 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'exp3.c')
-rw-r--r--exp3.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/exp3.c b/exp3.c
index 39eaca77c..57a1f7ad9 100644
--- a/exp3.c
+++ b/exp3.c
@@ -118,11 +118,10 @@ mpfr_exp_rational (mpfr_ptr y, mpz_srcptr p, int r, int m)
diff = mpz_sizeinbase(P[0], 2) - precy;
expo -= diff;
- /* since prec_i_have, which overestimates nbits(P[0]), can only exceed
- precy by nbits(i), we assume diff <= 0 here, but we did not manage
- to prove it, thus the assertion should be checked. */
- MPFR_ASSERTN(diff <= 0);
- mpz_mul_2exp (P[0], P[0], -diff);
+ if (diff > 0)
+ mpz_div_2exp (P[0], P[0], diff);
+ else
+ mpz_mul_2exp (P[0], P[0], -diff);
mpz_tdiv_q (S[0], S[0], P[0]);
mpfr_set_z (y, S[0], GMP_RNDD);