diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-05-04 06:26:56 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-05-04 06:26:56 +0000 |
commit | dc0666fe47eb3437fad92db4d8aa8e1a66596542 (patch) | |
tree | 1e5cead9aa3dead8be87eb9ce33535c8c73e1d19 /remquo.c | |
parent | 21e8a01e34ca4d6238f0cebeb0301d577f85cb86 (diff) | |
download | mpfr-dc0666fe47eb3437fad92db4d8aa8e1a66596542.tar.gz |
fixed problem when rem and x are the same variable
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4440 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'remquo.c')
-rw-r--r-- | remquo.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -120,7 +120,7 @@ mpfr_remquo (mpfr_ptr rem, long *quo, mpfr_srcptr x, mpfr_srcptr y, mp_rnd_t rnd) { mpfr_t q; - int inex, compare; + int inex, compare, signx; mp_exp_t ex, ey; mp_prec_t prec_q; @@ -192,10 +192,11 @@ mpfr_remquo (mpfr_ptr rem, long *quo, /* since we have no fused-multiply-and-subtract yet, we compute x + (-q)*y with an FMA */ mpfr_neg (q, q, GMP_RNDN); /* exact */ + signx = MPFR_SIGN(x); inex = mpfr_fma (rem, q, y, x, rnd); /* if rem is zero, it should have the sign of x */ if (MPFR_IS_ZERO (rem)) - MPFR_SET_SAME_SIGN(rem, x); + MPFR_SET_SIGN(rem, signx); /* rem and x may be the same variable */ mpfr_clear (q); |