diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-04-13 17:02:20 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-04-13 17:02:20 +0000 |
commit | 19ad9a1a95a0dc7d07d776aeeae017240e68a39f (patch) | |
tree | 9921a58f83c5c25bce107c9f9f55bc230784f34e /mul_ui.c | |
parent | 086b026b10774722e3706bf12b3cd76cf59c87e3 (diff) | |
download | mpfr-19ad9a1a95a0dc7d07d776aeeae017240e68a39f.tar.gz |
replaced 1st my by my+sh in mpfr_round_raw call
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@483 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul_ui.c')
-rw-r--r-- | mul_ui.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -37,7 +37,7 @@ mpfr_mul_ui(y, x, u, rnd_mode) #endif { mp_limb_t carry, *my, *old_my, *my2; unsigned long c; - unsigned long xsize, ysize, cnt, dif, ex; + unsigned long xsize, ysize, cnt, dif, ex, sh; TMP_DECL(marker); TMP_MARK(marker); @@ -60,9 +60,13 @@ mpfr_mul_ui(y, x, u, rnd_mode) if (carry) count_leading_zeros(cnt, carry); else cnt=BITS_PER_MP_LIMB; + /* Warning: the number of limbs used by x and the lower part + of y may differ */ + sh = (PREC(x)+BITS_PER_MP_LIMB-1)/BITS_PER_MP_LIMB + - (PREC(y)+cnt-1)/BITS_PER_MP_LIMB; + /* Warning: if all significant bits are in the carry, one has to be careful */ - if (cnt + PREC(y) < BITS_PER_MP_LIMB) { /* Quick 'n dirty */ @@ -82,7 +86,7 @@ mpfr_mul_ui(y, x, u, rnd_mode) carry = 0; cnt = BITS_PER_MP_LIMB; } - c = mpfr_round_raw(my, my, PREC(x), (MPFR_SIGN(x)<0), + c = mpfr_round_raw(my+sh, my, PREC(x), (MPFR_SIGN(x)<0), PREC(y)-BITS_PER_MP_LIMB+cnt, rnd_mode); /* If cnt = 1111111111111 and c = 1 we shall get depressed */ |