closeEnough function

bool closeEnough(
  1. double a,
  2. double b, [
  3. double tol = 1e-3
])

Helper to compare values with a small tolerance

Implementation

bool closeEnough(double a, double b, [double tol = 1e-3]) {
  return (a - b).abs() < tol;
}