summaryrefslogtreecommitdiff
path: root/add.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-12 16:54:28 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-12 16:54:28 +0000
commitb7307b74a0d4d766c1ba2c5d14f8ef918debc597 (patch)
treea5bbe3b493a5ea33eec5fa75cea859c2c4129fbc /add.c
parent750a34aaecd11ac48fcc73375172df708d0da844 (diff)
downloadmpfr-b7307b74a0d4d766c1ba2c5d14f8ef918debc597.tar.gz
improved coverage
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2695 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'add.c')
-rw-r--r--add.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/add.c b/add.c
index b9985872e..9d47652cb 100644
--- a/add.c
+++ b/add.c
@@ -33,6 +33,7 @@ mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
MPFR_SET_NAN(a);
MPFR_RET_NAN;
}
+ /* neither b nor c is NaN here */
else if (MPFR_IS_INF(b))
{
if (!MPFR_IS_INF(c) || MPFR_SIGN(b) == MPFR_SIGN(c))
@@ -53,6 +54,7 @@ mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
MPFR_SET_SAME_SIGN(a, c);
MPFR_RET(0); /* exact */
}
+ /* now either b or c is zero */
else if (MPFR_IS_ZERO(b))
{
if (MPFR_IS_ZERO(c))
@@ -66,12 +68,11 @@ mpfr_add (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
}
return mpfr_set(a, c, rnd_mode);
}
- else if (MPFR_IS_ZERO(c))
+ else /* necessarily c is 0 */
{
+ MPFR_ASSERTD(MPFR_IS_ZERO(c));
return mpfr_set(a, b, rnd_mode);
}
- /* Should never reach here */
- MPFR_ASSERTN(0);
}
MPFR_ASSERTD(MPFR_IS_PURE_FP(b) && MPFR_IS_PURE_FP(c));