summaryrefslogtreecommitdiff
path: root/div_ui.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-13 13:44:41 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2004-02-13 13:44:41 +0000
commit1931b8fa551b44b3ac787f2b077a231c4d339829 (patch)
treeddec24d0ab243d55f3e953f2b0d372d8773ecc13 /div_ui.c
parent006f3c4678c66c90ad60336c1a89be3bec7f0c2c (diff)
downloadmpfr-1931b8fa551b44b3ac787f2b077a231c4d339829.tar.gz
improved test coverage
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2706 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'div_ui.c')
-rw-r--r--div_ui.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/div_ui.c b/div_ui.c
index 0b2ec597d..7c799acef 100644
--- a/div_ui.c
+++ b/div_ui.c
@@ -46,8 +46,9 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
MPFR_SET_SAME_SIGN(y, x);
MPFR_RET(0);
}
- else if (MPFR_IS_ZERO(x))
+ else
{
+ MPFR_ASSERTD(MPFR_IS_ZERO(x));
if (u == 0)/* 0/0 is NaN */
{
MPFR_SET_NAN(y);
@@ -59,8 +60,6 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
MPFR_RET(0);
}
}
- else
- MPFR_ASSERTN(0);
}
if (MPFR_UNLIKELY(u == 0))
@@ -161,7 +160,8 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
mpfr_add_one_ulp (y, rnd_mode);
MPFR_RET(-1); /* result is inexact */
- case GMP_RNDN:
+ default:
+ MPFR_ASSERTD(rnd_mode == GMP_RNDN);
if (sh && d < (MP_LIMB_T_ONE << (sh - 1)))
MPFR_RET(-MPFR_INT_SIGN(x));
else if (sh && d > (MP_LIMB_T_ONE << (sh - 1)))
@@ -184,8 +184,6 @@ mpfr_div_ui (mpfr_ptr y, mpfr_srcptr x, unsigned long int u, mp_rnd_t rnd_mode)
else
MPFR_RET(-MPFR_INT_SIGN(x));
}
- default:
- MPFR_ASSERTN(0);
}
return 0; /* To avoid warning*/
}