Precision class

Represents the amount of precision for a measurement.

Because measurements are not perfectly precise, we do not want to imply that we know more than what we actually know to be true. For details, see Significant Figures

Measurements such as Distance will make use of a Precision you provide by giving answers within the bounds of the precision you specify when asked for any measurement value.

In general, measurements will not be considered "equal" if they have different precision, even if their measured values are the same.

Distance.meters(3.14159, precision: Precision(3)) ==
  Distance.meters(3.14159, precision: Precision(5)); // evaluates to false

Constructors

Precision(int precision)
Constructs a Precision of the specified number of digits.
Precision.combine(Precision a, Precision b)
Combines two Precisions per the "multiplication rule".

Properties

hashCode int
The hash code for this object.
no setteroverride
precision int
This precision, in number of digits.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
withPrecision(num value) double
Interprets the specified number according to this Precision.

Operators

operator ==(Object other) bool
The equality operator.
override

Static Methods

addition<T extends Measurement<T>>(Measurement<T> a, Measurement<T> b) Precision
Combines two Precisions per the "addition rule".
digitsAfterDecimal(Measurement<Measurement> measurement) int
Calculates the number of significant digits after the decimal point.
digitsBeforeDecimal(double number) int
Calculates the number of digits (significant or not) before the decimal.

Constants

max → const Precision
Maximum precision.
maximumPrecision → const int
The highest precision allowed.
single → const Precision
A single digit precision.