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 /add.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 'add.c')
-rw-r--r-- | add.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -87,9 +87,16 @@ mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode) } else { /* signs are equal, it's an addition */ - if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) - return mpfr_add1(a, c, b, rnd_mode); + if (MPFR_LIKELY(MPFR_PREC(a) == MPFR_PREC(b) + && MPFR_PREC(b) == MPFR_PREC(c))) + if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) + return mpfr_add1sp(a, c, b, rnd_mode); + else + return mpfr_add1sp(a, b, c, rnd_mode); else - return mpfr_add1(a, b, c, rnd_mode); + if (MPFR_GET_EXP(b) < MPFR_GET_EXP(c)) + return mpfr_add1(a, c, b, rnd_mode); + else + return mpfr_add1(a, b, c, rnd_mode); } } |