moreOrLessEquals function

Matcher moreOrLessEquals (double value, { double epsilon: 1e-10 })

Asserts that two doubles are equal, within some tolerated error.

Two values are considered equal if the difference between them is within 1e-10 of the larger one. This is an arbitrary value which can be adjusted using the epsilon argument. This matcher is intended to compare floating point numbers that are the result of different sequences of operations, such that they may have accumulated slightly different errors.

See also:

  • closeTo, which is identical except that the epsilon argument is required and not named.
  • inInclusiveRange, which matches if the argument is in a specified range.

Implementation

Matcher moreOrLessEquals(double value, { double epsilon = 1e-10 }) {
  return _MoreOrLessEquals(value, epsilon);
}