summaryrefslogtreecommitdiff
path: root/sub1.c
diff options
context:
space:
mode:
authorpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-02-15 14:51:51 +0000
committerpelissip <pelissip@280ebfd0-de03-0410-8827-d642c229c3f4>2005-02-15 14:51:51 +0000
commitf15b10bf988175c3639813b44cc7ee7f4973eb90 (patch)
tree286257fcebc1b4237f4c620a71eb1bbaf29eb7e5 /sub1.c
parentc37899364e36360ae8192404b8bcaae95ea0e246 (diff)
downloadmpfr-f15b10bf988175c3639813b44cc7ee7f4973eb90.tar.gz
mpfr_set doesn't produce an EVEN inexact flag.
Fix this. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3318 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'sub1.c')
-rw-r--r--sub1.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sub1.c b/sub1.c
index e30e7dd09..4829bd232 100644
--- a/sub1.c
+++ b/sub1.c
@@ -92,7 +92,12 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
= B.BBBBBBBBBBBBBBB
- C.CCCCCCCCCCCCC */
/* A = S*ABS(B) +/- ulp(a) */
- inexact = mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (a));
+ MPFR_SET_EXP (a, MPFR_GET_EXP (b));
+ MPFR_RNDRAW_EVEN (inexact, a, MPFR_MANT (b), MPFR_PREC (b),
+ rnd_mode, MPFR_SIGN (a),
+ if (MPFR_UNLIKELY ( ++MPFR_EXP (a) > __gmpfr_emax))
+ inexact = mpfr_overflow (a, rnd_mode, MPFR_SIGN (a)));
+ /* inexact = mpfr_set4 (a, b, rnd_mode, MPFR_SIGN (a)); */
if (inexact == 0)
{
/* a = b (Exact)
@@ -127,7 +132,7 @@ mpfr_sub1 (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mp_rnd_t rnd_mode)
which means we get a wrong rounded result if x==1,
i.e. inexact= MPFR_EVEN_INEX */
if (MPFR_UNLIKELY (inexact == MPFR_EVEN_INEX*MPFR_INT_SIGN (a))) {
- mpfr_nexttoward (a, c);
+ mpfr_nexttozero (a);
inexact = -MPFR_INT_SIGN (a);
}
return inexact;