summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-05-02 13:11:39 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-05-02 13:11:39 +0000
commit0f057f0a506a33ab329f97948ab12ed218f9810f (patch)
tree6d444b03860e3cc4a29aa6a36a756708edabf86b
parent0d4240e2eb12f51b98ea5e5199162dda6c119295 (diff)
downloadmpfr-0f057f0a506a33ab329f97948ab12ed218f9810f.tar.gz
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
-rw-r--r--subnormal.c14
1 files changed, 9 insertions, 5 deletions
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 <stdio.h>
#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;