[poincare] Fix bug in Multiplication::factorizeBase

Change-Id: If3ffc258c832e30f827eecb0a7c4e543341b5a21
This commit is contained in:
Émilie Feral
2017-10-10 18:08:27 +02:00
parent ffd49d81a5
commit 5b9045fe91
2 changed files with 2 additions and 1 deletions

View File

@@ -147,7 +147,7 @@ void Multiplication::factorizeBase(Expression * e1, Expression * e2) {
const Expression * operands[2] = {e1, s};
Power * p = new Power(operands, false);
s->immediateSimplify();
e1->replaceWith(p, false);
replaceOperand(e1, p, false);
p->immediateSimplify();
}
}

View File

@@ -118,6 +118,7 @@ QUIZ_CASE(poincare_simplify_easy) {
assert_parsed_expression_simplify_to("2^P*(1/2)^P", "1");
assert_parsed_expression_simplify_to("A^3*A^(-3)", "1");
assert_parsed_expression_simplify_to("1+A+2+B+3", "6+A+B");
assert_parsed_expression_simplify_to("(x+1)*(x+2)", "x^2+3x+2");
/* This does not work but should not as it is above k_primorial32 = 1*3*5*7*11*... (product of first 32 primes. */
//assert_parsed_expression_simplify_to("1881676377434183981909562699940347954480361860897069^(1/3)", "123456789123456789");