summaryrefslogtreecommitdiff
path: root/mul_2si.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-05-22 21:39:40 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2003-05-22 21:39:40 +0000
commit44b4dd94bb98c8d9e7850ae401232bd1b2ea3028 (patch)
tree9670f0ef8017d42ad2a2062dc08c63c022e450c8 /mul_2si.c
parent2f3cb289a102043a22bd32c5950db37199fb3fd2 (diff)
downloadmpfr-44b4dd94bb98c8d9e7850ae401232bd1b2ea3028.tar.gz
Macros MPFR_EXP_INVALID (invalid exponent value) and MPFR_EXP_CHECK
added. Code update to use MPFR_GET_EXP and MPFR_SET_EXP instead of MPFR_EXP to allow more bug detection related to special values. Macros MPFR_SET_NAN, MPFR_SET_INF, MPFR_SET_ZERO and MPFR_INIT set the exponent of the number to MPFR_EXP_INVALID if MPFR_EXP_CHECK is defined. Compile with -DMPFR_EXP_CHECK and make check to see the potential problems; currently, 40 of 76 tests fail. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2301 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'mul_2si.c')
-rw-r--r--mul_2si.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mul_2si.c b/mul_2si.c
index ad0b29f27..b3d4e3645 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, 2002 Free Software Foundation, Inc.
+Copyright 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
This file is part of the MPFR Library.
@@ -33,22 +33,22 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mp_rnd_t rnd_mode)
if (MPFR_IS_FP(y) && MPFR_NOTZERO(y))
{
+ mp_exp_t exp = MPFR_GET_EXP (y);
if (n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
- MPFR_EXP(y) > __gmpfr_emax - n))
+ exp > __gmpfr_emax - n))
return mpfr_set_overflow (y, rnd_mode, MPFR_SIGN(y));
if (n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
- MPFR_EXP(y) < __gmpfr_emin - n))
+ exp < __gmpfr_emin - n))
{
if (rnd_mode == GMP_RNDN &&
(__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
- MPFR_EXP(y) < __gmpfr_emin - (n + 1) ||
- mpfr_powerof2_raw (y)))
+ exp < __gmpfr_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;
+ MPFR_SET_EXP (y, exp + n);
}
return inexact;