diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-02-25 02:45:40 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-02-25 02:45:40 +0000 |
commit | 9c6b2ebb31e8d2245f15ebde3072db89da2c61ea (patch) | |
tree | efd3bc7f3200f4b5c1a09db7859ef30a998acae3 /src/mul_2si.c | |
parent | b741e3126467f733643e439af6a380765ca97b05 (diff) | |
download | mpfr-9c6b2ebb31e8d2245f15ebde3072db89da2c61ea.tar.gz |
Fixed mpfr_div_2si, mpfr_div_2ui and mpfr_mul_2si in some corner cases.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7486 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mul_2si.c')
-rw-r--r-- | src/mul_2si.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mul_2si.c b/src/mul_2si.c index 0ac0ea35f..79e3fa2d9 100644 --- a/src/mul_2si.c +++ b/src/mul_2si.c @@ -30,15 +30,15 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) MPFR_LOG_FUNC (("x[%#R]=%R n=%ld rnd=%d", x, x, n, rnd_mode), ("y[%#R]=%R inexact=%d", y, y, inexact)); - inexact = MPFR_UNLIKELY(y != x) ? mpfr_set (y, x, rnd_mode) : 0; - - if (MPFR_LIKELY( MPFR_IS_PURE_FP(y)) ) + if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x))) + return mpfr_set (y, x, rnd_mode); + else { - mpfr_exp_t exp = MPFR_GET_EXP (y); + mpfr_exp_t exp = MPFR_GET_EXP (x); + MPFR_SETRAW (inexact, y, x, exp, rnd_mode); if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n || exp > __gmpfr_emax - n))) return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y)); - else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n || exp < __gmpfr_emin - n))) { @@ -52,5 +52,5 @@ mpfr_mul_2si (mpfr_ptr y, mpfr_srcptr x, long int n, mpfr_rnd_t rnd_mode) MPFR_SET_EXP (y, exp + n); } - return inexact; + MPFR_RET (inexact); } |