summaryrefslogtreecommitdiff
path: root/agm.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-14 11:49:06 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2003-10-14 11:49:06 +0000
commit1fa2277c10582baa8b8402b8cf1702116ccbc560 (patch)
tree672209195ecad922dc489260098588b4dca469ad /agm.c
parent51aef80e83eaf2fc76dd6be59c0549e890dccd2b (diff)
downloadmpfr-1fa2277c10582baa8b8402b8cf1702116ccbc560.tar.gz
replaced mpfr_can_round (approx, err, rnd1, GMP_RNDN, prec)
by mpfr_can_round (approx, err, rnd1, GMP_RNDZ, prec + 1) which in addition guarantees a correct inexact flag git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2492 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'agm.c')
-rw-r--r--agm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/agm.c b/agm.c
index aeab2702e..f96c8340b 100644
--- a/agm.c
+++ b/agm.c
@@ -145,13 +145,14 @@ mpfr_agm (mpfr_ptr r, mpfr_srcptr op2, mpfr_srcptr op1, mp_rnd_t rnd_mode)
while (mpfr_cmp2(u, v, &eq) != 0 && eq <= p - 2);
/* Roundability of the result */
- can_round=mpfr_can_round(v,p-err-3,GMP_RNDN,rnd_mode,q);
+ can_round = mpfr_can_round (v, p - err - 3, GMP_RNDN, GMP_RNDZ,
+ q + (rnd_mode == GMP_RNDN));
if (can_round)
- go_on=0;
+ go_on = 0;
else {
- go_on=1;
+ go_on = 1;
p+=5;
s=(p-1)/BITS_PER_MP_LIMB+1;
MPFR_INIT(up, u, p, s);