summaryrefslogtreecommitdiff
path: root/set_d.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-12-13 02:35:45 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-12-13 02:35:45 +0000
commit1c6477d7d84205655c932eb2c46a27156b2477f0 (patch)
tree24d6202c783562c46e78334412f48b32b7c2ea9a /set_d.c
parent853e18c14801b4d8f0d235e7ec7648f27492bf35 (diff)
downloadmpfr-1c6477d7d84205655c932eb2c46a27156b2477f0.tar.gz
Assertion re-added.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2120 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_d.c')
-rw-r--r--set_d.c12
1 files changed, 12 insertions, 0 deletions
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;