diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-07 11:22:04 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-12-07 11:22:04 +0000 |
commit | 5d1f771f859d32d5821c15f39b63da057d5a13b1 (patch) | |
tree | c02b7190ce883c2511a1b8bc9e110d17844986c8 /div.c | |
parent | c0a2e91d56b1307c2d24507374915885aa2c5c9a (diff) | |
download | mpfr-5d1f771f859d32d5821c15f39b63da057d5a13b1.tar.gz |
in case the destination precision is less than that of the operands,
and the 1st iteration fails, increase directly the precision to the maximum
of that of the operands, otherwise divisions by 1.0 may need lots of
iterations
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@837 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'div.c')
-rw-r--r-- | div.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -218,11 +218,18 @@ mpfr_div (r, u, v, rnd_mode) then we have the correct RNDZ rounding */ if (!can_round && (rsize < usize || rsize < vsize)) - { + { #ifdef DEBUG - printf("Increasing the precision.\n"); + printf("Increasing the precision.\n"); #endif - TMP_FREE(marker); + TMP_FREE(marker); + /* in case we can't round at the first iteration, + jump right away to the maximum precision of both + operands, to avoid multiple iterations when for + example the divisor is 1.0. + */ + if (rsize < usize) rsize = usize - 1; + if (rsize < vsize) rsize = vsize - 1; } } while (!can_round && (rsize < usize || rsize < vsize) |