diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-10-23 01:52:28 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-10-23 01:52:28 +0000 |
commit | 8989d82866c990e9cddcb2947f837d447d1d4e9d (patch) | |
tree | 14a1d998ce97ba85a7ce2d101c822d849478f6ed /subnormal.c | |
parent | 6da961037f00f9f28194921bafb57c5e0a4fcbaf (diff) | |
download | mpfr-8989d82866c990e9cddcb2947f837d447d1d4e9d.tar.gz |
Changeset r4904 introduced an assertion failure, but the assertion
emax - emin >= PREC(x) wasn't necessary: the value of emax doesn't
matter, except when the exponent is increased due to the rounding.
So, we just document that if the result cannot be represented in the
current exponent range, the behavior is undefined (updated mpfr.texi
accordingly). Removed the assertion from subnormal.c and added a new
one to have an abort if such an undefined behavior occurs.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4905 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'subnormal.c')
-rw-r--r-- | subnormal.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/subnormal.c b/subnormal.c index 0014ef0de..a95df02ee 100644 --- a/subnormal.c +++ b/subnormal.c @@ -41,8 +41,6 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mp_rnd_t rnd) { int inexact = 0; - MPFR_ASSERTD ((mpfr_uexp_t) __gmpfr_emax - __gmpfr_emin >= MPFR_PREC (y)); - /* The subnormal exponent range are from: mpfr_emin to mpfr_emin + MPFR_PREC(y) - 1 */ if (MPFR_LIKELY (MPFR_IS_SINGULAR (y) @@ -97,6 +95,7 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mp_rnd_t rnd) else { set_min_p1: + /* Note: mpfr_setmin will abort if __gmpfr_emax == __gmpfr_emin. */ mpfr_setmin (y, __gmpfr_emin + 1); inexact = MPFR_SIGN (y); } @@ -138,7 +137,8 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mp_rnd_t rnd) inexact = old_inexact; } old_inexact = mpfr_set (y, dest, rnd); - MPFR_ASSERTD (old_inexact == 0); + MPFR_ASSERTN (old_inexact == 0); + MPFR_ASSERTN (MPFR_IS_PURE_FP (y)); mpfr_clear (dest); } return inexact; |