From 3e4b655cf986bfa21b1f39d515b10ae346bb751b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 21 Aug 2018 15:27:59 +0200 Subject: [PATCH] [poincare] Fix Multiplication::factorizeExponent --- poincare/src/multiplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poincare/src/multiplication.cpp b/poincare/src/multiplication.cpp index 44137dc70..620acb15e 100644 --- a/poincare/src/multiplication.cpp +++ b/poincare/src/multiplication.cpp @@ -503,9 +503,9 @@ void Multiplication::factorizeExponent(int i, int j, Context & context, Preferen * example, it turns Multiplication(2^x,3^x) into Multiplication(6^x). */ // Step 1: find the new base - Expression s = Multiplication(childAtIndex(i), childAtIndex(j)).shallowReduce(context, angleUnit); // 2^x*3^x -> (2*3)^x -> 6^x + Expression m = Multiplication(Base(childAtIndex(i)), Base(childAtIndex(j))).shallowReduce(context, angleUnit); // 2^x*3^x -> (2*3)^x -> 6^x // Step 2: create the new power - Expression p = Power(childAtIndex(i).childAtIndex(0), s).shallowReduce(context, angleUnit); // 2^x*(1/2)^x -> (2*1/2)^x -> 1 + Expression p = Power(m, childAtIndex(i).childAtIndex(1)).shallowReduce(context, angleUnit); // 2^x*(1/2)^x -> (2*1/2)^x -> 1 // Step 3: Replace one of the child replaceChildAtIndexInPlace(i, p); // Step 4: Get rid of the other child