3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-06-22 14:18:53 -07:00
parent 5e8a4b98d4
commit 7386f2e045

View file

@ -1313,17 +1313,18 @@ namespace opt {
rational r = n.get_rational(); rational r = n.get_rational();
rational eps = n.get_infinitesimal(); rational eps = n.get_infinitesimal();
expr_ref_vector args(m); expr_ref_vector args(m);
bool is_int = eps.is_zero() && r.is_int();
if (!inf.is_zero()) { if (!inf.is_zero()) {
expr* oo = m.mk_const(symbol("oo"), m_arith.mk_int()); expr* oo = m.mk_const(symbol("oo"), is_int ? m_arith.mk_int() : m_arith.mk_real());
if (inf.is_one()) { if (inf.is_one()) {
args.push_back(oo); args.push_back(oo);
} }
else { else {
args.push_back(m_arith.mk_mul(m_arith.mk_numeral(inf, inf.is_int()), oo)); args.push_back(m_arith.mk_mul(m_arith.mk_numeral(inf, is_int), oo));
} }
} }
if (!r.is_zero()) { if (!r.is_zero()) {
args.push_back(m_arith.mk_numeral(r, r.is_int())); args.push_back(m_arith.mk_numeral(r, is_int));
} }
if (!eps.is_zero()) { if (!eps.is_zero()) {
expr* ep = m.mk_const(symbol("epsilon"), m_arith.mk_real()); expr* ep = m.mk_const(symbol("epsilon"), m_arith.mk_real());
@ -1331,7 +1332,7 @@ namespace opt {
args.push_back(ep); args.push_back(ep);
} }
else { else {
args.push_back(m_arith.mk_mul(m_arith.mk_numeral(eps, eps.is_int()), ep)); args.push_back(m_arith.mk_mul(m_arith.mk_numeral(eps, is_int), ep));
} }
} }
switch(args.size()) { switch(args.size()) {