From 4ff938f2c1a0f7e629c2c44bc822ef06565169c1 Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Tue, 1 Aug 2017 16:46:10 +0100 Subject: [PATCH] Fixed MPF fp.rem(0,0,0). Relates to #872. --- src/util/mpf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/mpf.cpp b/src/util/mpf.cpp index 584e01642..7287b69cf 100644 --- a/src/util/mpf.cpp +++ b/src/util/mpf.cpp @@ -797,9 +797,9 @@ void mpf_manager::fma(mpf_rounding_mode rm, mpf const & x, mpf const & y, mpf co set(o, z); } else if (is_zero(x) || is_zero(y)) { - bool xy_sgn = is_neg(x) ^ is_neg(y); - if (is_zero(z) && xy_sgn ^ is_neg(z)) - mk_zero(x.ebits, x.sbits, rm != MPF_ROUND_TOWARD_NEGATIVE, o); + bool xy_sgn = sgn(x) ^ sgn(y); + if (is_zero(z) && (xy_sgn ^ sgn(z))) + mk_zero(x.ebits, x.sbits, rm == MPF_ROUND_TOWARD_NEGATIVE, o); else set(o, z); }