approximately method

  1. @useResult
bool approximately(
  1. double other,
  2. double epsilon
)

Returns true if this and other are within the epsilon of each other.

1.0002.approximately(1.0, 0.01); // true

1.2.approximately(1.0, 0.01); // false

Implementation

@useResult bool approximately(double other, double epsilon) => (this - other).abs() <= epsilon;