When tuning the representative without tuning the prefix, the prefix
would not be reset to its default value, causing a problem for masses,
whose base prefix depend on the representative (k for grams, none for
the rest).
Fixes a crash when typing sqrt(_N) with country set to US.
Change-Id: Iade900de5fb31e06fdfafef34ae27da3f36983fa
In metric, sqrt(N) would be simplified to _N_kg^-0.5_m^-0.5_s instead of
_kg^0.5_m^0.5_s^-1.
We solve this issue by preventing simplification using derived units
in presence of rational exponents.
Change-Id: I97118bb32c963809c8d176b7b297d1682965e9af
In Trigonometry::shallowReduceInverseFunction, the reduction of
atan(1/x) used the hard value of pi instead of its equivalent in the
selected angle unit.
This fixes a bug causing atan(1/tan(40°)) to be equal to π/2-40 instead
of 50.
Change-Id: Ifd7df5cd168fadf3146eee168c0bc2136ea15a7b
Temperatures can be converted to and from degree Celsius and Fahrenheit.
When used in non-trivial calculations, they are always reduced to undef,
as the rules for manipulating relative scales are not well defined.
Change-Id: If59e224a0e7f940b421bc894bbe2279c90f38d04
With the imperial system selected, volumes are expressed as volume in
Calculation's results, instead of cubic lengths.
Change-Id: Ib6c0a1a595dce8ae8db6371b41af818b3fdc6236
1. Information about a unit's dimension now uses inheritance.
_m is an instance of DistanceAlias, which is derived from Alias.
A UnitNode now keeps a pointer to an Alias and one to a Prefix.
All aliases are still defined as constexpr.
This cleans up a lot of the code used namely for computing the
additional outputs in Calculation.
2. Instead of being defined with a string, each unit is described by its
ratio with the base SI unit (ex: _L is 0.001 instead of "0.001_m^3").
This greatly speeds up the calculations using units, as the algorithm
to find the best unit used to parse the definition.
Change-Id: I4d6ed6ad4cb967026a3f01a335aec270066e2b9f
This fixes issues #1541. Formulas as asin(sin(X)) with X a large number
were failling to simplify themselves into the image interval of asin
ex : previous version asin(sin(6)) = 6
new version asin(sin(6)) = -2pi+6
Change-Id: Ia6200b67914224cecd2cd943bcf9bc2ff6e0447a
Derivation propagates as expected on multiplications (but not power). Some tests involving diff had to be updated to reflect that behaviour.
Change-Id: Ifa32031bc37a156c18d296757bcdd6ccdb0ea43e
"undef" when the left expression is neither a custom variable or
function nor a unit.
This makes the behaviour consistent on theses expressions:
2 -> a+a
2 -> 2*a