isApproximatelyEqual method

bool isApproximatelyEqual(
  1. double other, {
  2. double epsilon = 0.0001,
})

Checks if the number is approximately equal to other within epsilon.

Example:

3.14159.isApproximatelyEqual(3.14, epsilon: 0.01); // true

Implementation

bool isApproximatelyEqual(double other, {double epsilon = 0.0001}) {
  return (this - other).absValue < epsilon;
}