From 49a4df0de144fb87b23d8af01be4816a428da25b Mon Sep 17 00:00:00 2001 From: "Christoph M. Wintersteiger" Date: Thu, 28 May 2015 12:54:57 +0100 Subject: [PATCH] MPF min/max -+0.0 special cases changed to +0.0 instead of second argument. Another piece of fix #68 --- src/util/mpf.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/util/mpf.cpp b/src/util/mpf.cpp index 1521a8f87..57e5b56b5 100644 --- a/src/util/mpf.cpp +++ b/src/util/mpf.cpp @@ -1229,7 +1229,11 @@ void mpf_manager::rem(mpf const & x, mpf const & y, mpf & o) { } void mpf_manager::maximum(mpf const & x, mpf const & y, mpf & o) { - if (is_nan(x) || (is_zero(x) && is_zero(y))) + if (is_nan(x)) + set(o, y); + else if (is_zero(x) && is_zero(y) && sgn(x) != sgn(y)) + mk_pzero(x.ebits, x.sbits, o); + else if (is_zero(x) && is_zero(y)) set(o, y); else if (is_nan(y)) set(o, x); @@ -1240,7 +1244,11 @@ void mpf_manager::maximum(mpf const & x, mpf const & y, mpf & o) { } void mpf_manager::minimum(mpf const & x, mpf const & y, mpf & o) { - if (is_nan(x) || (is_zero(x) && is_zero(y))) + if (is_nan(x)) + set(o, y); + else if (is_zero(x) && is_zero(y) && sgn(x) != sgn(y)) + mk_pzero(x.ebits, x.sbits, o); + else if (is_zero(x) && is_zero(y)) set(o, y); else if (is_nan(y)) set(o, x);