From c5cc871841d35e1f673bedeb55a3889ae386e7d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 12 Jun 2018 15:05:48 +0200 Subject: [PATCH] [poincare] Expression::getLinearCoefficients: the constant coefficient has to be reduced before returned --- poincare/src/expression.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/poincare/src/expression.cpp b/poincare/src/expression.cpp index 34c97d5c9..22e30cfcd 100644 --- a/poincare/src/expression.cpp +++ b/poincare/src/expression.cpp @@ -257,7 +257,10 @@ bool Expression::getLinearCoefficients(char * variables, Expression * coefficien index++; } *constant = new Opposite(equation, false); - // xy = 0? + Reduce(constant, context); + /* The expression can be linear on all coefficients taken one by one but + * non-linear (ex: xy = 2). We delete the results and return false if one of + * the coefficients contains a variable. */ bool isMultivariablePolynomial = (*constant)->recursivelyMatches(dependsOnVariables, context); for (int i = 0; i < index; i++) { if (isMultivariablePolynomial) {