diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-09-06 11:35:12 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2001-09-06 11:35:12 +0000 |
commit | 1beda657394742b840f5b02394183e0163146987 (patch) | |
tree | 70a5eee89fc3707983395287166aac285848ee2b /add.c | |
parent | 26d3521b157f21c132e118fff20dbbd836308146 (diff) | |
download | mpfr-1beda657394742b840f5b02394183e0163146987.tar.gz |
In add.c: use mpfr_cmp_abs instead of mpfr_cmp3; x - x fixed for GMP_RNDD.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1165 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'add.c')
-rw-r--r-- | add.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -566,14 +566,16 @@ mpfr_add (a, b, c, rnd_mode) } else { /* MPFR_EXP(b) == MPFR_EXP(c) */ - int diff_exp = mpfr_cmp3(b,c,-1); - /* if b>0 and diff_exp>0 or b<0 and diff_exp<0: abs(b) > abs(c) */ - if (diff_exp == 0) + int d = mpfr_cmp_abs(b,c); + if (d == 0) { - MPFR_SET_POS(a); + if (rnd_mode == GMP_RNDD) + MPFR_SET_NEG(a); + else + MPFR_SET_POS(a); MPFR_SET_ZERO(a); } - else if (diff_exp * MPFR_SIGN(b) > 0) + else if (d > 0) mpfr_sub1(a, b, c, rnd_mode, 0); else mpfr_sub1(a, c, b, rnd_mode, 0); |