diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-12-09 13:52:50 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2003-12-09 13:52:50 +0000 |
commit | e97bb114dc859b50ac84a62ee8747f6cde0a98c4 (patch) | |
tree | 56e9936e70bf10ad3d73380c9d839947106bb4ff /add.c | |
parent | b0a8072e3f96fb138f35b466d50bcbe2336bbec6 (diff) | |
download | mpfr-e97bb114dc859b50ac84a62ee8747f6cde0a98c4.tar.gz |
+ Add function mpfr_print_mantissa_binary, for debugging reason.
+ Rename MPFR_ALLOC_SIZE in MPFR_MALLOC_SIZE.
+ Add conditionnal -DSMALL directive in mpfr-impl.h.
+ Add new function: sub1sp.
Substraction in case of all the ops have the same prec.
+ Add its test (tsub1sp).
+ Modify a few the tests to avoid comparing mpfr results with double, for portability reason.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2569 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'add.c')
-rw-r--r-- | add.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -79,9 +79,13 @@ mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) MPFR_ASSERTD(MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c)); MPFR_CLEAR_FLAGS(a); /* clear flags */ - if (MPFR_SIGN(b) != MPFR_SIGN(c)) + if (MPFR_UNLIKELY(MPFR_SIGN(b) != MPFR_SIGN(c))) { /* signs differ, it's a subtraction */ - return mpfr_sub1(a, b, c, rnd_mode); + if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b) + && MPFR_PREC(b) == MPFR_PREC(c))) + return mpfr_sub1sp(a,b,c,rnd_mode); + else + return mpfr_sub1(a, b, c, rnd_mode); } else { /* signs are equal, it's an addition */ |