From d6b577b7dcd23a568fcc7cc78014d27a099fb33f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 18 Dec 2017 10:42:16 +0100 Subject: [PATCH] [poincare] Do not apply a^(b+c)->a^b*a^c when a is null (0^(5-2) != 0^5*0^(-2)) --- poincare/src/power.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/poincare/src/power.cpp b/poincare/src/power.cpp index 36c251107..64b029aec 100644 --- a/poincare/src/power.cpp +++ b/poincare/src/power.cpp @@ -338,8 +338,8 @@ Expression * Power::shallowReduce(Context& context, AngleUnit angleUnit) { } } } - // a^(b+c) -> Rational(a^b)*a^c with a and b rational - if (!letPowerAtRoot && operand(0)->type() == Type::Rational && operand(1)->type() == Type::Addition) { + // a^(b+c) -> Rational(a^b)*a^c with a and b rational and a != 0 + if (!letPowerAtRoot && operand(0)->type() == Type::Rational && !static_cast(operand(0))->isZero() && operand(1)->type() == Type::Addition) { Addition * a = static_cast(editableOperand(1)); // Check is b is rational if (a->operand(0)->type() == Type::Rational) {