diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 1999-06-21 13:45:56 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 1999-06-21 13:45:56 +0000 |
commit | 8079f348bae434b1596e09a30e3aa39f33f5ee8f (patch) | |
tree | 39e9fa19a603efc0c8689b0c137bd90ab68f40b7 /set_prec.c | |
parent | d689c8f2ce9ebaf39545d0c620e3f225ce1be791 (diff) | |
download | mpfr-8079f348bae434b1596e09a30e3aa39f33f5ee8f.tar.gz |
Changement de semantique (plus d'arrondi) et alloc + free -> realloc.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@114 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_prec.c')
-rw-r--r-- | set_prec.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/set_prec.c b/set_prec.c index a044a5344..77e3594e0 100644 --- a/set_prec.c +++ b/set_prec.c @@ -19,19 +19,12 @@ mpfr_set_prec (x, p, rnd_mode) printf("*** cannot set precision to 0 bits\n"); exit(1); } - oldp = x -> _mp_prec; - oldsize = (oldp-1)/BITS_PER_MP_LIMB + 1; - if (SIGN(x)<0) oldsize = oldsize ^ (1<<31); xsize = (p - 1)/BITS_PER_MP_LIMB + 1; /* new limb size */ - old = x -> _mp_d; - x -> _mp_d = (mp_ptr) (*_mp_allocate_func) - (xsize * BYTES_PER_MP_LIMB); + x -> _mp_d = (mp_ptr) (*_mp_reallocate_func) + (x -> _mp_d, ABSSIZE(x)*BYTES_PER_MP_LIMB, xsize * BYTES_PER_MP_LIMB); x -> _mp_prec = p; - mpfr_round_raw(x -> _mp_d, old, rnd_mode, oldsize, p); SIZE(x) = (SIGN(x)>0) ? xsize : (xsize ^ (1<<31)); - - (*_mp_free_func) (old, 1 + ((oldp-1)>>3)); } unsigned long int |