Commit Graph

1952 Commits

Author SHA1 Message Date
Émilie Feral
8ceb368047 [poincare] Adding a number before orphan unit is done at beautification
instead of at reducing (revert previous commit)

This fixes the following bug: input log(0*f(_t)) --> crash due to an
infinite loop where we remove/add 1 before the multiplication
2020-06-04 14:50:10 +02:00
Émilie Feral
ade90db392 [poincare] UnitConvert: implement removeUnit since UnitConvert can be a
reduced expression
2020-06-04 14:50:09 +02:00
Émilie Feral
9a3e2c960f [escher] LayoutField: update the grey squares when using insertion
cursor
2020-06-04 14:50:08 +02:00
Léa Saviot
3e4478454c [escher] Avoid useless redrawing in ExpressionView::setLayout 2020-06-04 14:50:08 +02:00
Émilie Feral
7b2d020128 [poincare] Unit: implement IsIS 2020-06-04 14:50:07 +02:00
Émilie Feral
0f4eee2d71 [poincare] Add comment on how Units are built 2020-06-04 14:50:07 +02:00
Émilie Feral
a48f65ba95 [poincare] Unit: ensure one unique instance of each prefix 2020-06-04 14:50:07 +02:00
Émilie Feral
bcbdc9312e [poincare] Fix Unit::isSecond, Unit::isMeter and Unit::isKilogram: the
EmptyPrefix is not unique, we can't only compare pointers
2020-06-04 14:50:07 +02:00
Émilie Feral
3b7d7e7898 [poincare] Clean magic numbers in Unit 2020-06-04 14:50:07 +02:00
Émilie Feral
67b1c12bf7 [poincare] Remove useless variables 2020-06-04 14:50:07 +02:00
Émilie Feral
5fa50ec79d [poincare] Unit::BuildTimeSplit can split negative time 2020-06-04 14:50:03 +02:00
Émilie Feral
73a598e023 [poincare] Unit: enable to tune both the prefix and the Representant or
just the prefix on a given Unit
2020-06-04 14:50:03 +02:00
Émilie Feral
ec95ed0789 [poincare] Add Unit::ElectronVolt builder 2020-06-04 14:50:03 +02:00
Émilie Feral
53db27ffeb [poincare] Discard UnitConversion::Classic mode. This will be done in
Calculation app
2020-06-04 14:50:03 +02:00
Émilie Feral
7b28f760b7 [poincare] Float: float can be layouted 2020-06-04 14:50:03 +02:00
Émilie Feral
845a118073 [poincare] Add Unit::BuildTimeSplit and helpers for time units 2020-06-04 14:50:02 +02:00
Émilie Feral
94c5941fb5 [poincare] Unit: improve ChooseBestMultipleForValue 2020-06-04 14:50:02 +02:00
Émilie Feral
4d7b9aa2a9 [poincare] Add watthour representation to classic unit conversion 2020-06-04 14:50:02 +02:00
Émilie Feral
cc114900fa [poincare] Add Liter representation to classic unit conversion 2020-06-04 14:50:02 +02:00
Émilie Feral
e2dc79c2d5 [poincare] Partially implement simplification for UnitConversion::Classic 2020-06-04 14:50:02 +02:00
Émilie Feral
ae71c23147 [poincare] Override method Unit::node to return UnitNode 2020-06-04 14:50:01 +02:00
Émilie Feral
3308b13b9c [poincare] UnitConvert:
- do the smart part at beautification to avoid
requiring an escape case just for UnitConvert
- Use UnitConvert::None
2020-06-04 14:50:01 +02:00
Émilie Feral
3f34e5e644 [poincare] Enable to choose the "UnitConversion" mode at simplification
between: only SI, none, default...
2020-06-04 14:50:01 +02:00
Émilie Feral
d805c59202 [poincare] Fix extractUnit into removeUnit paradigm 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
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
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
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
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
e018c9ddc8 [poincare/trigonometry_cheat_table] Reorder parameter names correctly 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
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
67241bb564 [poincare] Make code more object oriented
Turn ExponentsOfBaseUnits function into a static method of the
Unit::Dimension::Vector class
2020-06-04 14:50:00 +02:00
Ruben Dashyan
b6d07cbd90 [poincare] Make code more object oriented
Turn ExponentsOfBaseUnits function into a method of the
Unit::Dimension::Vector class
2020-06-04 14:50:00 +02:00
Ruben Dashyan
e2cdf78605 [poincare] Define and use Unit::Dimension::Vector::Metrics 2020-06-04 14:50:00 +02:00
Ruben Dashyan
0eb6df27dc [poincare] Turn Unit::Dimension::Vector type into a struct 2020-06-04 14:50:00 +02:00
Ruben Dashyan
202beb3b13 [poincare/unit] Add comment about namespace and scope usage 2020-06-04 14:50:00 +02:00
Ruben Dashyan
2fa71e4350 [poincare] Define and use Unit::NumberOfBaseUnits instead of magic number 2020-06-04 14:50:00 +02:00
Ruben Dashyan
be2892eae5 [poincare] Define Unit::Dimension::Vector type 2020-06-04 14:50:00 +02:00
Charlotte THOMAS
0f2f51cdf4 A stop to the imparialism of the US Units
A constant rule the total number of units
Passed the lbs and inch as base units to avoid unwanted conversion from SI to imperial ones
2020-05-08 18:20:57 +02:00
Léa Saviot
bbb8308a6d [poincare/normal_distribution] More values are computed
We limited the precision too much before.
2020-05-06 01:01:58 -07:00
M4x1m3
f7609e0001 [poincare] Made the simu build again on linux. 2020-04-19 15:23:29 +02:00
M4x1m3
2f01603c4d [ion/3ds] Got it to build. 2020-04-19 15:23:04 +02:00
Quentin
13874cd2e0 Merge branch 'omega-hotfix' into omega-dev 2020-04-16 14:24:47 +02:00
Quentin
f37040dc8a [Fix] Conflicts 2020-04-16 14:04:56 +02:00
Léa Saviot
9988447b9a [poincare] Expression::isIdenticalToWithoutParentheses 2020-04-15 09:16:32 -04:00
Romain Goyet
807dd73e7b [poincare] Use a Tuple instead of an ArrayBuilder for expression
The Tuple is simply an initializer_list along with a convenience method
to cast between a list of TreeHandle and a list of Expression
2020-04-10 13:35:14 -04:00
Neven Sajko
c92b770112 Performance fixes relating to floating point constants
This replaces unnecessary double-precision soft-float operations with
single-precision floating-point operations, mainly by casting.

In a couple places I also replace a function call with a constant.
2020-04-09 13:58:56 +02:00