diff options
author | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-12 13:49:44 +0000 |
---|---|---|
committer | pelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-12 13:49:44 +0000 |
commit | 859d0ad282e99fe442820365a7502c6beeaafcc4 (patch) | |
tree | c39e694d507352f21884a80219657ff250d80f9b /sub.c | |
parent | 10c4bdb6e6cb0a84720fc9d8c1f3bc91fceca204 (diff) | |
download | mpfr-859d0ad282e99fe442820365a7502c6beeaafcc4.tar.gz |
+ Add mpfr_add1sp which provides addition when all the operands have the same precision.
+ Add new test files for mpfr_copysign and mpfr_min and mpfr_max.
+ Add test for mpfr_exp10 in tests/texp.c
+ Improve coverage of div_2ui.c and mul_2ui.c
+ Add a forgotten ASSERT in mpfr_sqrt
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2686 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sub.c')
-rw-r--r-- | sub.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -95,13 +95,21 @@ mpfr_sub (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) rnd_mode = GMP_RNDD; else if (rnd_mode == GMP_RNDD) rnd_mode = GMP_RNDU; - inexact = mpfr_add1(a, c, b, rnd_mode); + if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b) + && MPFR_PREC(b) == MPFR_PREC(c))) + inexact = mpfr_add1sp(a, c, b, rnd_mode); + else + inexact = mpfr_add1(a, c, b, rnd_mode); MPFR_CHANGE_SIGN(a); return -inexact; } else { - return mpfr_add1(a, b, c, rnd_mode); + if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b) + && MPFR_PREC(b) == MPFR_PREC(c))) + return mpfr_add1sp(a, b, c, rnd_mode); + else + return mpfr_add1(a, b, c, rnd_mode); } } } |