Commit b6d775bb authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

Don't try to optimize out certain polynomials

BUG: 418597
parent 237204f3
......@@ -197,7 +197,7 @@ Polynomial::Polynomial(Apply* c)
Monomial imono(m_operator, *it, m_sign);
bool added=false;
if(imono.second->isApply()) {
if(imono.second->isApply() && imono.first == 1) {
Apply* a = static_cast<Apply*>(imono.second);
Operator op=a->firstOperator();
if(a->firstOperator()==m_operator
......
......@@ -85,7 +85,7 @@ class Polynomial : public QList<Monomial>
private:
void addMonomial(const Monomial& m);
void addValue(Analitza::Object* value);
void simpScalars(bool m_firstValue);
void simpScalars(bool firstValue);
QVector<Object*> m_scalars;
Operator m_operator;
......
......@@ -669,6 +669,7 @@ void AnalitzaTest::testSimplify_data()
QTest::newRow("poli4") << "-x-1-2-4" << "-x-7";
QTest::newRow("poli4.0") << "-x-y-z" << "-x-y-z";
QTest::newRow("poli4.1") << "minus(-x, 1, 2, 4)" << "-x-7";
QTest::newRow("poli5") << "y+3*(x-1)" << "y+3*(x-1)";
// QTest::newRow("powerscomb") << "3**x*3**x" << "9^x";
QTest::newRow("no var") << "2+2" << "4";
QTest::newRow("simple") << "x+x" << "2*x";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment