summaryrefslogtreecommitdiff
path: root/sub.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-12-09 13:52:50 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2003-12-09 13:52:50 +0000
commite97bb114dc859b50ac84a62ee8747f6cde0a98c4 (patch)
tree56e9936e70bf10ad3d73380c9d839947106bb4ff /sub.c
parentb0a8072e3f96fb138f35b466d50bcbe2336bbec6 (diff)
downloadmpfr-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 'sub.c')
-rw-r--r--sub.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sub.c b/sub.c
index 0c9128bce..409f87a6c 100644
--- a/sub.c
+++ b/sub.c
@@ -80,9 +80,13 @@ mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
MPFR_CLEAR_FLAGS(a);
MPFR_ASSERTD(MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c));
- if (MPFR_SIGN(b) == MPFR_SIGN(c))
+ if (MPFR_LIKELY(MPFR_SIGN(b) == MPFR_SIGN(c)))
{ /* signs are equal, it's a real 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 differ, it's an addition */