summaryrefslogtreecommitdiff
path: root/add.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-27 11:16:02 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2001-10-27 11:16:02 +0000
commita62085d5d7ab53e3cff600226455ceadda15d573 (patch)
tree1327fd99b03d3289cfc1c1bf2b4172daecfc3a9a /add.c
parent8f9e71f46236bbc896e671807a54e02f769429f6 (diff)
downloadmpfr-a62085d5d7ab53e3cff600226455ceadda15d573.tar.gz
Bug fixed.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1441 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'add.c')
-rw-r--r--add.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/add.c b/add.c
index 9af0c3543..1c8378287 100644
--- a/add.c
+++ b/add.c
@@ -294,11 +294,11 @@ mpfr_add1 (a, b, c, rnd_mode, diff_exp)
if (difs)
{
cc = cprev << (BITS_PER_MP_LIMB - difs);
- if (ck > 0)
- {
- cprev = cp[--ck];
- cc += cprev >> difs;
- }
+ if (--ck >= 0)
+ {
+ cprev = cp[ck];
+ cc += cprev >> difs;
+ }
}
else
cc = cp[--ck];
@@ -341,9 +341,9 @@ mpfr_add1 (a, b, c, rnd_mode, diff_exp)
if (ck < 0)
goto c_read;
cc = cprev << (BITS_PER_MP_LIMB - difs);
- if (ck > 0)
+ if (--ck >= 0)
{
- cprev = cp[--ck];
+ cprev = cp[ck];
cc += cprev >> difs;
}
}
@@ -385,14 +385,13 @@ mpfr_add1 (a, b, c, rnd_mode, diff_exp)
/* b has entirely been read */
- if (fb)
+ if (fb || ck < 0)
goto rounding;
if (difs && cprev << (BITS_PER_MP_LIMB - difs))
{
fb = 1;
goto rounding;
}
- MPFR_ASSERTN(ck >= 0);
while (ck)
{
if (cp[--ck])