summaryrefslogtreecommitdiff
path: root/round_near_x.c
diff options
context:
space:
mode:
authorzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-12-14 13:24:44 +0000
committerzimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4>2007-12-14 13:24:44 +0000
commitd8ba81763de164841a0f4ea742f0f85e20234a0c (patch)
tree908499b65bcbb6dc8b16338b0bca7b33275d44cf /round_near_x.c
parent399ac314a63d995e820520212d83956274075126 (diff)
downloadmpfr-d8ba81763de164841a0f4ea742f0f85e20234a0c.tar.gz
added comments, got rid of compiler warnings
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5087 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'round_near_x.c')
-rw-r--r--round_near_x.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/round_near_x.c b/round_near_x.c
index 5a81a3435..dfb550daf 100644
--- a/round_near_x.c
+++ b/round_near_x.c
@@ -171,7 +171,7 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
|| mpfr_round_p (MPFR_MANT (v), MPFR_LIMB_SIZE (v),
(mp_exp_t) err,
MPFR_PREC (y) + (rnd == GMP_RNDN)))))
- /* If we assume we can not round, return 0 */
+ /* If we assume we can not round, return 0, and y is not modified */
return 0;
/* First round v in y */
@@ -201,7 +201,7 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
inexact = sign;
if (MPFR_IS_LIKE_RNDZ (rnd, MPFR_IS_NEG_SIGN (sign)))
{
- nexttozero:
+ /* case nexttozero */
/* The underflow flag should be set if the result is zero */
__gmpfr_flags = old_flags;
inexact = -sign;
@@ -217,7 +217,7 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
if (rnd != GMP_RNDN && rnd != GMP_RNDZ
&& MPFR_IS_RNDUTEST_OR_RNDDNOTTEST (rnd, MPFR_IS_POS_SIGN(sign)))
{
- nexttoinf:
+ /* case nexttoinf */
/* The overflow flag should be set if the result is infinity */
inexact = sign;
mpfr_nexttoinf (y);
@@ -227,5 +227,8 @@ mpfr_round_near_x (mpfr_ptr y, mpfr_srcptr v, mpfr_uexp_t err, int dir,
}
}
+ /* the inexact flag cannot be 0, since this would mean an exact value,
+ and in this case we cannot round correctly */
+ MPFR_ASSERTD(inexact != 0);
MPFR_RET (inexact);
}