mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
[solver] Equation: fix edge case: if the equation was simplified because
always true, the standard form must be 0
This commit is contained in:
@@ -37,7 +37,14 @@ void Equation::tidy() {
|
||||
|
||||
Expression * Equation::standardForm(Context * context) const {
|
||||
if (m_standardForm == nullptr) {
|
||||
m_standardForm = static_cast<const Equal *>(expression(context))->standardEquation(*context);
|
||||
Expression * e = expression(context);
|
||||
if (e->type() == Expression::Type::Equal) {
|
||||
m_standardForm = static_cast<const Equal *>(e)->standardEquation(*context);
|
||||
} else {
|
||||
// The equality was reduced which means the equality was always true.
|
||||
assert(e->type() == Expression::Type::Rational && static_cast<Rational *>(e)->isOne());
|
||||
m_standardForm = new Rational(0);
|
||||
}
|
||||
}
|
||||
return m_standardForm;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user