This class represents a determinate or estimated amount for which
operations such as addition, subtraction, multiplication and division
can be performed (it implements the
Field interface).
The nature of an amount can be deduced from its parameterization
(compile time) or its
Amount.getUnit() unit (run time).
Its precision is given by its
Amount.getAbsoluteError() error .
Amounts can be
Amount.isExact() exact , in which case they can be
expressed as an exact long integer in the amount unit.
The framework tries to keep amount exact as much as possible.
For example:[code]
Amount m = Amount.valueOf(33, FOOT).divide(11).times(2);
System.out.println(m);
System.out.println(m.isExact() ? "exact" : "inexact");
System.out.println(m.getExactValue());
> 6 ft
> exact
> 6[/code]
Errors (including numeric errors) are calculated using numeric intervals.
It is possible to resolve systems of linear equations involving
org.jscience.mathematics.vector.Matrix matrices , even if the
system is close to singularity; in which case the error associated with
some (or all) components of the solution may be large.
By default, non-exact amounts are shown using the plus/minus
character ('±') (see
AmountFormat ). |