mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
Corrected unspecified behavior of corner cases in fp.min/fp.max.
Partially addresses #68.
This commit is contained in:
parent
6e852762ba
commit
8a026c355f
10 changed files with 211 additions and 55 deletions
|
@ -1248,12 +1248,13 @@ 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))
|
||||
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);
|
||||
else if (is_zero(x) && is_zero(y) && sgn(x) != sgn(y)) {
|
||||
UNREACHABLE(); // max(+0, -0) and max(-0, +0) are unspecified.
|
||||
}
|
||||
else if (is_zero(x) && is_zero(y))
|
||||
set(o, y);
|
||||
else if (gt(x, y))
|
||||
set(o, x);
|
||||
else
|
||||
|
@ -1263,12 +1264,13 @@ 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))
|
||||
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);
|
||||
else if (is_zero(x) && is_zero(y) && sgn(x) != sgn(y)) {
|
||||
UNREACHABLE(); // min(+0, -0) and min(-0, +0) are unspecified.
|
||||
}
|
||||
else if (is_zero(x) && is_zero(y))
|
||||
set(o, y);
|
||||
else if (lt(x, y))
|
||||
set(o, x);
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue