diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-11-29 16:29:28 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-11-29 16:29:28 +0000 |
commit | 260191013f43cc00cf83e1e3e17061bfa6986094 (patch) | |
tree | ec3af52323403133105f979f8eb4403635cc76b1 /sub.c | |
parent | d34b8d331b608bb33748f5de25fe48ada4ba9055 (diff) | |
download | mpfr-260191013f43cc00cf83e1e3e17061bfa6986094.tar.gz |
fixed potential problem in mpfr_sub1 (k=0 and kc<0)
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@805 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sub.c')
-rw-r--r-- | sub.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -350,7 +350,8 @@ mpfr_sub1(a, b, c, rnd_mode, diff_exp) cc -= mpn_sub_1(&c2, bp+k, 1, cp[0]<<(BITS_PER_MP_LIMB-dif)); } else { /* no more limb from b */ - if (cp[kc+1]<<(BITS_PER_MP_LIMB-dif)) cc=-1; + /* warning: if k was 0, kc can be negative here */ + if ((kc+1>=0) && (cp[kc+1]<<(BITS_PER_MP_LIMB-dif))) cc=-1; else while ((cc==0) && (kc>=0)) { if (cp[kc]) cc=-1; kc--; |