From 1c6477d7d84205655c932eb2c46a27156b2477f0 Mon Sep 17 00:00:00 2001 From: vlefevre Date: Fri, 13 Dec 2002 02:35:45 +0000 Subject: Assertion re-added. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2120 280ebfd0-de03-0410-8827-d642c229c3f4 --- set_d.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'set_d.c') diff --git a/set_d.c b/set_d.c index 2068be4ea..7f290f613 100644 --- a/set_d.c +++ b/set_d.c @@ -205,6 +205,18 @@ mpfr_set_d (mpfr_ptr r, double d, mp_rnd_t rnd_mode) MPFR_EXP(tmp) = __mpfr_extract_double (tmpmant, d); +#ifndef NDEBUG + /* Failed assertion if the stored value is 0 (e.g., if the exponent range + has been reduced at the wrong moment and an underflow to 0 occurred). + Probably a bug in the C implementation if this happens. */ + i = 0; + while (tmpmant[i] == 0) + { + i++; + MPFR_ASSERTN(i < MPFR_LIMBS_PER_DOUBLE); + } +#endif + /* determine the index i-1 of the most significant non-zero limb and the number k of zero high limbs */ i = MPFR_LIMBS_PER_DOUBLE; -- cgit v1.2.1