summaryrefslogtreecommitdiff
path: root/mul_2si.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-04-23 20:00:42 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2002-04-23 20:00:42 +0000
commit55dce27825331d17d9551678b043dbbbba5345ed (patch)
treed91880efc3cb6723193007c84e93d153b1f4d7fe /mul_2si.c
parent2e8f831311bfb69b69770d64e4573202d342a94b (diff)
downloadmpfr-55dce27825331d17d9551678b043dbbbba5345ed.tar.gz
Underflow semantics changed (not tested).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@1910 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul_2si.c')
-rw-r--r--mul_2si.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/mul_2si.c b/mul_2si.c
index 25066e0a2..cdc522425 100644
--- a/mul_2si.c
+++ b/mul_2si.c
@@ -1,6 +1,6 @@
/* mpfr_mul_2si -- multiply a floating-point number by a power of two
-Copyright 1999, 2001 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2002 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -39,7 +39,14 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode)
if (n < 0 && (__mpfr_emin > MPFR_EMAX_MAX + n ||
MPFR_EXP(y) < __mpfr_emin - n))
- return mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y));
+ {
+ if (rnd_mode == GMP_RNDN &&
+ (__mpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
+ MPFR_EXP(y) < __mpfr_emin - (n + 1) ||
+ mpfr_powerof2_raw (y)))
+ rnd_mode = GMP_RNDZ;
+ return mpfr_set_underflow (y, rnd_mode, MPFR_SIGN(y));
+ }
MPFR_EXP(y) += n;
}