Émilie Feral
e4848a7535
[apps/calculation] HistoryController: favour understandable code
2020-06-04 14:50:01 +02:00
Ruben Dashyan
266482ef99
[apps/calculation] Additional outputs for Unit
2020-06-04 14:50:01 +02:00
Ruben Dashyan
f8050f0673
[poincare/symbol_abstract] Remove redundant code
...
This case is already handled in shallowReduce of Function and Symbol
2020-06-04 14:50:01 +02:00
Ruben Dashyan
407ce0534c
[poincare/expression] Use extractUnits instead of hasUnit when possible
2020-06-04 14:50:01 +02:00
Ruben Dashyan
f227cd719f
[poincare/multiplication] Use extractUnits instead of splitIntoNormalForm in shallowBeautify
2020-06-04 14:50:01 +02:00
Ruben Dashyan
914bb38a8e
[poincare/test/helper] Do not beautify in assert_simplify helper function
...
Simplifying a Store expression does not generally reduce the children,
so the children should probably not be beautified ?
2020-06-04 14:50:01 +02:00
Ruben Dashyan
c71cce2957
[poincare/test] Factor assertions
2020-06-04 14:50:01 +02:00
Ruben Dashyan
651b705dbd
Revert "[poincare/expression] deepBeautify bubbles up Undefined children"
...
This reverts commit 300399fe4d .
Not necessary anymore to bubble up Undefined children in deepBeautify
since Unit::shallowBeautify does not introduce any Undefined Expression.
2020-06-04 14:50:01 +02:00
Ruben Dashyan
01b94f8543
[poincare/unit] Units homogeneity is already handled in each Expression subclass
...
specifically if needed or generically in defaultHandleUnitsInChildren
2020-06-04 14:50:01 +02:00
Ruben Dashyan
7ef28a93bc
[poincare/multiplication] Do not expand Multiplication in presence of units
2020-06-04 14:50:01 +02:00
Ruben Dashyan
bf9653d510
[poincare/expression] Turn getUnit into extractUnits
...
Addition::shallowReduce factors the unit across its terms.
Previously expressions of the form 1_m+π_m were reduced to undef.
2020-06-04 14:50:01 +02:00
Ruben Dashyan
94e1fdfc7a
[poincare/test/simplification] Uncomment passing tests
2020-06-04 14:50:01 +02:00
Ruben Dashyan
f2bfc7ec9b
[poincare/expression] Remove redundancies in getUnit
2020-06-04 14:50:01 +02:00
Ruben Dashyan
9a762f1bf6
[poincare] A (Power of) Unit must not be orphan
2020-06-04 14:50:01 +02:00
Ruben Dashyan
c12ab3a2e2
[poincare/multiplication] Simplify shallowBeautify
2020-06-04 14:50:01 +02:00
Ruben Dashyan
2895d365a6
[poincare/multiplication] Make sure a Multiplication is not made of (Power of) Units only
2020-06-04 14:50:01 +02:00
Ruben Dashyan
4d1129b0db
[poincare/multiplication] Reorder steps in shallowBeautify
2020-06-04 14:50:01 +02:00
Ruben Dashyan
b8786dd32c
Revert "[poincare/multiplication] Fix handling of units with non-integer exponent"
...
This reverts commit 50f1ee9721 .
Since Power::shallowReduce now checks that the exponent of a Unit is an
Integer, instead of Unit::shallowBeautify, there is no need anymore to
handle that in Multiplication::splitIntoNormalForm.
2020-06-04 14:50:01 +02:00
Ruben Dashyan
1351babe37
[poincare] Move Power vs Unit checks to Power::shallowReduce
2020-06-04 14:50:01 +02:00
Ruben Dashyan
fa1235939b
[poincare/multiplication] Correct cast
2020-06-04 14:50:01 +02:00
Ruben Dashyan
c181650922
[poincare/multiplication] Simplify privateShallowReduce
2020-06-04 14:50:01 +02:00
Ruben Dashyan
f224ac31e3
[poincare/n_ary_expression] Add TODO about mergeSameTypeChildrenInPlace
2020-06-04 14:50:01 +02:00
Ruben Dashyan
965e3b1d9a
[poincare/n_ary_expression] Factor mergeMultiplicationChildrenInPlace
...
from Multiplication to NAryExpression so as to use it in Addition
2020-06-04 14:50:01 +02:00
Ruben Dashyan
43327e482e
[poincare/multiplication] Use mergeChildrenAtIndexInPlace instead of mergeMultiplicationChildrenInPlace
2020-06-04 14:50:01 +02:00
Ruben Dashyan
4558e777c8
[poincare/multiplication] Remove old TODO
2020-06-04 14:50:01 +02:00
Ruben Dashyan
0c4434d088
[poincare/expression] getUnit returns an uninitialized Expression
...
when there is no Unit instead of Undefined
2020-06-04 14:50:01 +02:00
Ruben Dashyan
f5b964339c
[poincare/test/expression_properties] Fix helper assert_reduced_expression_unit
...
First reduce
Then getUnit
2020-06-04 14:50:01 +02:00
Ruben Dashyan
2fea3c9b3a
[poincare/addition] Addition has no Unit
2020-06-04 14:50:01 +02:00
Ruben Dashyan
121e16a6a5
[poincare/absolute_value] AbsoluteValue has no Unit
...
shallowReduce returns Undefined if its unique child has a Unit
2020-06-04 14:50:01 +02:00
Ruben Dashyan
032723eae1
[poincare/layout_node] Remove unused variable
2020-06-04 14:50:01 +02:00
Ruben Dashyan
8365735f98
[apps/calculation/additional_outputs/expression_list_controller] Computed Layouts must not be uninitialized
2020-06-04 14:50:01 +02:00
Ruben Dashyan
a31524173f
[apps/calculation/history_controller] Factor handleEvent
2020-06-04 14:50:01 +02:00
Ruben Dashyan
a3265996fe
[apps/calculation/history_controller] Factor handleEvent
2020-06-04 14:50:01 +02:00
Ruben Dashyan
f3bcedd43d
[apps/calculation/history_controller] Simplify and harmonize handleEvent
2020-06-04 14:50:01 +02:00
Ruben Dashyan
167827f0e4
[apps/calculation] EditExpressionController accesses subview directly
2020-06-04 14:50:01 +02:00
Ruben Dashyan
63ab8710b9
[apps/calculation] Factor EditExpressionController::insertTextBody
2020-06-04 14:50:01 +02:00
Ruben Dashyan
145381ad4b
[apps/calculation/additional_outputs] Remove parentResponder parameter from ListControllers' constructor
...
which was always set to nullptr
2020-06-04 14:50:01 +02:00
Ruben Dashyan
e018c9ddc8
[poincare/trigonometry_cheat_table] Reorder parameter names correctly
2020-06-04 14:50:01 +02:00
Ruben Dashyan
b8993eafa9
[poincare/expression] Call reduce instead of deepReduce
2020-06-04 14:50:01 +02:00
Ruben Dashyan
8e71e03b6e
[poincare] Remove ostream and iostream header inclusions and keep them precisely where needed
2020-06-04 14:50:01 +02:00
Ruben Dashyan
b05202f2ec
[poincare] Remove stdio.h inclusions
2020-06-04 14:50:01 +02:00
Ruben Dashyan
e03c628381
[poincare/multiplication] shallowBeautify builds Unit only if necessary
2020-06-04 14:50:01 +02:00
Ruben Dashyan
e43362eee0
[poincare/multiplication] Factor CanSimplifyUnitProduct
2020-06-04 14:50:01 +02:00
Ruben Dashyan
9cbbffcdd6
[poincare/multiplication] shallowBeautify builds Power only if necessary
2020-06-04 14:50:01 +02:00
Ruben Dashyan
94bad10ddb
[poincare/multiplication] CanSimplifyUnitProduct gets int8_t entryUnitExponent parameter instead of operationOnExponents
2020-06-04 14:50:00 +02:00
Ruben Dashyan
79a81968c8
[poincare/unit] Avoid cloning expression in Dimension::Vector::FromBaseUnits
2020-06-04 14:50:00 +02:00
Ruben Dashyan
2f708cc36c
[poincare/unit] Dimension::Vector::FromBaseUnits accepts only products of powers of base units
...
and no other factor at all
2020-06-04 14:50:00 +02:00
Ruben Dashyan
394e86a28a
[poincare] Unit::Dimension holds a Vector
...
The Vector does not need to be recomputed from a Representative's
definition, which requires parsing and time-consuming reduction.
2020-06-04 14:50:00 +02:00
Ruben Dashyan
d7dab2ae99
[poincare/multiplication] bestUnitNorm not necessary anymore
2020-06-04 14:50:00 +02:00
Ruben Dashyan
191680d96f
[poincare/multiplication] Simplify Unit::Dimension::Vector::Metrics comparison
2020-06-04 14:50:00 +02:00