diff --git a/poincare/include/poincare/tree_pool.h b/poincare/include/poincare/tree_pool.h index 8caf78128..cf5108d73 100644 --- a/poincare/include/poincare/tree_pool.h +++ b/poincare/include/poincare/tree_pool.h @@ -7,8 +7,8 @@ #include #include #if POINCARE_TREE_LOG -#include #include +#include #endif namespace Poincare { diff --git a/poincare/include/poincare/unit.h b/poincare/include/poincare/unit.h index 68d2ce221..0646323e5 100644 --- a/poincare/include/poincare/unit.h +++ b/poincare/include/poincare/unit.h @@ -256,13 +256,9 @@ public: Representative::Prefixable::No, NoPrefix), }, - SolideAngleRepresentatives[] = { Representative("sr", nullptr, Representative::Prefixable::No, NoPrefix), }, - - - MassRepresentatives[] = { Representative("g", nullptr, Representative::Prefixable::Yes, @@ -299,15 +295,12 @@ public: Representative::Prefixable::Yes, PositiveLongScalePrefixes), }, - LuminousFluxRepresentatives[] = { Representative("lm", "_cd*_sr", Representative::Prefixable::No, NoPrefix), }, - IlluminanceRepresentatives[] = { Representative("lx", "_cd*_sr*_m^(-2)", Representative::Prefixable::No, NoPrefix), }, - ForceRepresentatives[] = { Representative("N", "_kg*_m*_s^-2", Representative::Prefixable::Yes, diff --git a/poincare/src/unit.cpp b/poincare/src/unit.cpp index a3aa7e754..13d63f01d 100644 --- a/poincare/src/unit.cpp +++ b/poincare/src/unit.cpp @@ -224,29 +224,14 @@ Unit Unit::Builder(const Dimension * dimension, const Representative * represent } Expression Unit::shallowReduce(ExpressionNode::ReductionContext reductionContext) { - - if (reductionContext.symbolicComputation() == ExpressionNode::SymbolicComputation::ReplaceAllSymbolsWithUndefinedAndDoNotReplaceUnits) { return *this; } - - UnitNode * unitNode = static_cast(node()); - - const Dimension * dim = unitNode->dimension(); - - const Representative * rep = unitNode->representative(); - - const Prefix * pre = unitNode->prefix(); - - - int8_t prefixMultiplier = pre->exponent(); - - if (rep == dim->stdRepresentative()) { const Prefix * stdPre = dim->stdRepresentativePrefix(); unitNode->setPrefix(stdPre); @@ -258,15 +243,10 @@ Expression Unit::shallowReduce(ExpressionNode::ReductionContext reductionContext } else { result = Expression::Parse(rep->definition(), nullptr, false).deepReduce(reductionContext); } - - - if (prefixMultiplier != 0) { Expression multiplier = Power::Builder(Rational::Builder(10), Rational::Builder(prefixMultiplier)).shallowReduce(reductionContext); result = Multiplication::Builder(multiplier, result).shallowReduce(reductionContext); } - - replaceWithInPlace(result); return result; }