From 0f057f0a506a33ab329f97948ab12ed218f9810f Mon Sep 17 00:00:00 2001 From: pelissip Date: Mon, 2 May 2005 13:11:39 +0000 Subject: Fix a bug: the test to detect EVEN_rounding was wrong. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3508 280ebfd0-de03-0410-8827-d642c229c3f4 --- subnormal.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'subnormal.c') diff --git a/subnormal.c b/subnormal.c index ec423c80e..75f5bf228 100644 --- a/subnormal.c +++ b/subnormal.c @@ -20,6 +20,7 @@ along with the MPFR Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include "mpfr-impl.h" /* For GMP_RNDN, we can have a problem of double rounding. @@ -122,11 +123,14 @@ mpfr_subnormalize (mpfr_ptr y, int old_inexact, mp_rnd_t rnd) if (MPFR_UNLIKELY(rnd==GMP_RNDN && (inexact == MPFR_EVEN_INEX || inexact == -MPFR_EVEN_INEX))) { - if (old_inexact*MPFR_SIGN (y) < 0) - mpfr_nexttoinf (dest); - else - mpfr_nexttozero (dest); - inexact = -inexact; + if (old_inexact*inexact*MPFR_INT_SIGN (y) > 0) + { + if (inexact < 0) + mpfr_nexttoinf (dest); + else + mpfr_nexttozero (dest); + inexact = -inexact; + } } else if (MPFR_UNLIKELY (inexact == 0)) inexact = old_inexact; -- cgit v1.2.1