extern "C" { #include #include #include #include } #include #include #include #include #include #include #include #include #include #include #include #include "layout/char_layout.h" #include "layout/horizontal_layout.h" namespace Poincare { Expression::Type Equal::type() const { return Type::Equal; } Expression * Equal::clone() const { return new Equal(operands(), true); } int Equal::polynomialDegree(char symbolName) const { return -1; } Expression * Equal::standardEquation(Context & context, AngleUnit angleUnit) const { Expression * sub = new Subtraction(operand(0), operand(1), true); Reduce(&sub, context, angleUnit); return sub; } Expression * Equal::shallowReduce(Context& context, AngleUnit angleUnit) { Expression * e = Expression::shallowReduce(context, angleUnit); if (e != this) { return e; } if (operand(0)->isIdenticalTo(operand(1))) { return replaceWith(new Rational(1), true); } return this; } ExpressionLayout * Equal::createLayout(PrintFloat::Mode floatDisplayMode, int numberOfSignificantDigits) const { HorizontalLayout * result = new HorizontalLayout(); result->addOrMergeChildAtIndex(operand(0)->createLayout(floatDisplayMode, numberOfSignificantDigits), 0, false); result->addChildAtIndex(new CharLayout('='), result->numberOfChildren()); result->addOrMergeChildAtIndex(operand(1)->createLayout(floatDisplayMode, numberOfSignificantDigits), result->numberOfChildren(), false); return result; } template Evaluation * Equal::templatedApproximate(Context& context, AngleUnit angleUnit) const { return new Complex(Complex::Undefined()); } }