Additional results are proposed for all units combinations that include
a non-base unit, in addition to units with special results.
Change-Id: I91f2a1a43c72bad0327132396534a223e87b06a2
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
The solutions of equations that need numerical approximations to be
solved are now computed base on the undeveloped equation (instead of
fully the expended one used to identify polynomials)
This allow (x-10)^7=0 to yield x=10 as result (9.95 before)
Change-Id: Ia8acbe57a9cfebf0b5016e9c896d21c8ddac7a64
Mixed fractions for negative rational numbers are now computed as the
opposite of their opposite's mixed fraction, as is conventionnal.
ex : -9/5 is now decomposed as -1-4/5 instead of -2+1/5
Change-Id: I6df3dce585ccadd1bcd7cc562576995face98f9c
Sequences can now be defined using specific terms form other sequences :
Un = n
Vn = u(3)
Initial values can also depend on other sequences.
Should there be a circular dependency, the sequences concerned will
display "undef" as value
Change-Id: I6fe1f3ff7b500f35d480ddefb42de729c327432e
In UnitConvert::shallowBeautify, an orphan expression would be reduced
without reaffecting the reduction's result. The reduction not being
taken into account would cause problem when handling undef values.
ex : Try to calculate i->_min
Change-Id: I4e53afa40ba838fed8c2fba9944c9c9ed1dc95b4
Implemented std::nextafter to replace hand made one.
Methods next and previous are no longer making the difference between -0
and +0
Change-Id: I42e1a073623b70656d9df954694803840cf3088c
Method characteristicXHalfRange was used to compute the range on which
to display cartesian function in Graph. With the new zoom algorithm,
this method is deprecated.
Change-Id: Ic681fab8d58d0f5628a94302a7b49dacaaa1a6a3
In Graph, the weak ReductionTarget would cause _X^0 to not be simplified
to 1, and would break an assertion in
Unit::chooseBestRepresentativeAndPrefix.
Change-Id: I8167a472802baf0a73bf48513f492e78517107ef
When factoring 1^inf * 1^-inf with Multiplication::factorizeBase, an
Undef factor would appear an be carried into the reduced multiplication.
We escape early in this situation by returning Undef.
Change-Id: Id826ad3cc131349e5bb460f7a8c82fe606294b97
The addSibling method sometimes did not take into account the offset
introduced by adding parentheses, leading to some issues :
- Type 2 SQUARE RIGHTPARENTHESIS LEFT SQUARE. Parentheses are added
but the new square should be outside, between the two right
parentheses.
Change-Id: Ifbc49cee2cd03c4511fc5a678d6d5d42243f4a22
When typing Square in 2D Edition mode, the cursor would not be
repositionned correctly, leading to some issues :
- Typing 2 POW 3, pressing RIGHT to return to the baseline, then
typing POW again adds parentheses around 2^3, as is mathematically
correct. Typing 2 SQUARE, then POW, would show 2^2^_, while
the user really typed (2^2)^_.
Change-Id: I29c01d964924907a1866490189ea56e40771521d
With the imperial system selected, volumes are expressed as volume in
Calculation's results, instead of cubic lengths.
Change-Id: Ib6c0a1a595dce8ae8db6371b41af818b3fdc6236
In additional outputs, a volume is now splitted as :
_gal+_qt+_pt+_cup
instead of :
_gal+_cup+_floz
Change-Id: I5020afbab23be6331d8a8742fd6295db178f0b37
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
The symbol for pint (_pt) conflicts with the symbol for pico-tonne. To
solve that, prefixes for tonnes are now restricted to the positive
prefixes : k, M, G, T.
Change-Id: Ie968374bbb5e0ebd2c0f08e4b1bdc1708eb6a041
The additional results on units now include conversions into both unit
systems (metric and imperial).
Change-Id: Ie0f12eb3735e775560b66c2cbd78bc9a659145bb
Added methods to return the standard format for each dimension,
depending on the chosen unit system.
Change-Id: I3591a806beca315674cc09093b57e8753db5db6a
A split (such as _h+_min+_s) can now be generated for distances, volumes
and masses using imperial units.
Change-Id: Ib3ad63614979eddd02fbe0e99f16cf09dcf7c1fc
BuildTimesplit (used to create expressions of the form h+min+s) is now
based on the more general BuildSplit.
Change-Id: I3e55359cc6b9735269140942b29bd1d364fc35e7
When the country is USA, the units will be simplified to common imperial
units rather than metric.
Change-Id: Ia533527a429ac26526380e324b9543b359f3b400
The new units are :
distance mile, yard, foot, inch
mass pound, ounce
volume gallon, quart, pint, cup, fluid ounce
table spoon, tea spoon
Change-Id: I6864067a1822a077764ed3b61fc46004732e9447
Multiplication::privateShallowReduce can create an Undef node by
multiplying 0 and inf. In this case, we set the whole multiplication to
undef, to avoid things such as undef*π.
This fixes the following bug :
- In Graph, enter i*inf*π as one of the bounds. An assertion fails in
Multiplication::removeUnit.
Change-Id: Ie9d0d561d6e310f52220b98541f22a4b5e56762c