diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-11-05 09:00:03 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-11-05 09:00:03 +0000 |
commit | c1ff1a575e238532d7329dd5ebb15f5f48581868 (patch) | |
tree | acffa24515dd52bde31d602617354cc5a7682160 /add1.c | |
parent | bc3b76bc225273a3d94929207a38d0b4ed43a4f5 (diff) | |
download | mpfr-c1ff1a575e238532d7329dd5ebb15f5f48581868.tar.gz |
Add a real function for mpfr_sgn (not a call to mpfr_cmp_ui_2exp).
Add a test for mpfr_sgn.
Change the proto of mpfr_add1 and mpfr_sub1 by removing the last arg.
Simplify the logic of the sign in mpfr_sub1.
Tiny speed up for cmp/set/sqrt.
mpfr-impl auto include all the needed local header files (gmp, gmp-impl, mpfr).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2534 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'add1.c')
-rw-r--r-- | add1.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -30,14 +30,14 @@ MA 02111-1307, USA. */ which is >= 0 */ int -mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, - mp_rnd_t rnd_mode, mp_exp_unsigned_t diff_exp) +mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) { mp_limb_t *ap, *bp, *cp; mp_prec_t aq, bq, cq, aq2; mp_size_t an, bn, cn; mp_exp_t difw, exp; int sh, rb, fb, inex; + mp_exp_unsigned_t diff_exp; TMP_DECL(marker); MPFR_ASSERTD(MPFR_IS_PURE_FP(b)); @@ -52,12 +52,15 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, bq = MPFR_PREC(b); cq = MPFR_PREC(c); + diff_exp = (mp_exp_unsigned_t) bq - cq; + an = (aq-1)/BITS_PER_MP_LIMB + 1; /* number of significant limbs of a */ aq2 = (mp_prec_t) an * BITS_PER_MP_LIMB; sh = aq2 - aq; /* non-significant bits in low limb */ + bn = (bq-1)/BITS_PER_MP_LIMB + 1; /* number of significant limbs of b */ cn = (cq-1)/BITS_PER_MP_LIMB + 1; /* number of significant limbs of c */ - + if (ap == bp) { bp = (mp_ptr) TMP_ALLOC (bn * BYTES_PER_MP_LIMB); @@ -73,6 +76,7 @@ mpfr_add1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, exp = MPFR_GET_EXP (b); MPFR_SET_SAME_SIGN(a, b); + diff_exp = (mp_exp_unsigned_t) exp - MPFR_GET_EXP(c); /* * 1. Compute the significant part A', the non-significant bits of A |