summaryrefslogtreecommitdiff
path: root/set_prec.c
diff options
context:
space:
mode:
authorhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>1999-06-22 13:33:35 +0000
committerhanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4>1999-06-22 13:33:35 +0000
commit67b06a00e6b93be323d7edb6870dab659ad9943c (patch)
treeebce3793c59cd45a04a212d5767c3bcd93b357ec /set_prec.c
parentd09f7fcb5b1d0e9a15408f983c7f6ff9813961d0 (diff)
downloadmpfr-67b06a00e6b93be323d7edb6870dab659ad9943c.tar.gz
Fill with 0 the part added in case of a larger reallocation.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@129 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_prec.c')
-rw-r--r--set_prec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/set_prec.c b/set_prec.c
index 77e3594e0..0cdd2575f 100644
--- a/set_prec.c
+++ b/set_prec.c
@@ -23,6 +23,10 @@ mpfr_set_prec (x, p, rnd_mode)
x -> _mp_d = (mp_ptr) (*_mp_reallocate_func)
(x -> _mp_d, ABSSIZE(x)*BYTES_PER_MP_LIMB, xsize * BYTES_PER_MP_LIMB);
+
+ if (xsize > ABSSIZE(x))
+ MPN_ZERO(x -> _mp_d, xsize - ABSSIZE(x));
+
x -> _mp_prec = p;
SIZE(x) = (SIGN(x)>0) ? xsize : (xsize ^ (1<<31));
}