operator - method

  1. @override
Quantity operator -(
  1. dynamic subtrahend
)
override

Returns the difference of this Quantity and subtrahend or (this - q2).

Only a Quantity object having the same dimensions as this Quantity object may be subtracted from it.

  • If an attempt is made to subtract a Quantity object having different dimensions from this Quantity object, this operator will throw a DimensionsException.
  • If the uncertainty is calculated it will be equal to the combined standard uncertainty divided by the absolute value of the difference of the quantities. The standard uncertainty is the square root of the sum of the squares of the two quantities' standard uncertainties.

See NIST Reference on Constants, Units, and Uncertainty: Combining uncertainty components.

Implementation

@override
Quantity operator -(dynamic subtrahend) {
  if (subtrahend is PowerLevel) {
    return PowerLevel.inUnits(0.5 * math.log(ratio - subtrahend.ratio), Level.nepers);
  } else {
    return super - subtrahend;
  }
}