mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 20:18:18 +00:00
fix #4154
This commit is contained in:
parent
1f9e022168
commit
1dc8b597b4
|
@ -797,7 +797,7 @@ namespace smt {
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
void theory_dense_diff_logic<Ext>::fix_zero() {
|
void theory_dense_diff_logic<Ext>::fix_zero() {
|
||||||
int num_vars = get_num_vars();
|
int num_vars = get_num_vars();
|
||||||
for (int v = 0; v < num_vars; ++v) {
|
for (int v = 0; v < num_vars && v < (int)m_assignment.size(); ++v) {
|
||||||
enode * n = get_enode(v);
|
enode * n = get_enode(v);
|
||||||
if (m_autil.is_zero(n->get_owner()) && !m_assignment[v].is_zero()) {
|
if (m_autil.is_zero(n->get_owner()) && !m_assignment[v].is_zero()) {
|
||||||
numeral val = m_assignment[v];
|
numeral val = m_assignment[v];
|
||||||
|
@ -823,14 +823,18 @@ namespace smt {
|
||||||
void theory_dense_diff_logic<Ext>::init_model(model_generator & m) {
|
void theory_dense_diff_logic<Ext>::init_model(model_generator & m) {
|
||||||
m_factory = alloc(arith_factory, get_manager());
|
m_factory = alloc(arith_factory, get_manager());
|
||||||
m.register_factory(m_factory);
|
m.register_factory(m_factory);
|
||||||
|
if (!m_assignment.empty()) {
|
||||||
fix_zero();
|
fix_zero();
|
||||||
compute_epsilon();
|
compute_epsilon();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
template<typename Ext>
|
template<typename Ext>
|
||||||
model_value_proc * theory_dense_diff_logic<Ext>::mk_value(enode * n, model_generator & mg) {
|
model_value_proc * theory_dense_diff_logic<Ext>::mk_value(enode * n, model_generator & mg) {
|
||||||
theory_var v = n->get_th_var(get_id());
|
theory_var v = n->get_th_var(get_id());
|
||||||
SASSERT(v != null_theory_var);
|
SASSERT(v != null_theory_var);
|
||||||
|
if (v >= (int)m_assignment.size())
|
||||||
|
return alloc(expr_wrapper_proc, m_factory->mk_num_value(rational::zero(), is_int(v)));
|
||||||
numeral const & val = m_assignment[v];
|
numeral const & val = m_assignment[v];
|
||||||
rational num = val.get_rational().to_rational() + m_epsilon * val.get_infinitesimal().to_rational();
|
rational num = val.get_rational().to_rational() + m_epsilon * val.get_infinitesimal().to_rational();
|
||||||
return alloc(expr_wrapper_proc, m_factory->mk_num_value(num, is_int(v)));
|
return alloc(expr_wrapper_proc, m_factory->mk_num_value(num, is_int(v)));
|
||||||
|
|
Loading…
Reference in a new issue