almostEqualRelativeI function

bool almostEqualRelativeI(
  1. double a,
  2. double b,
  3. int decimalPlaces
)

Compares two doubles and determines if they are equal to within the specified number of decimal places or not. If the numbers are very close to zero an absolute difference is compared, otherwise the relative difference is compared.

Implementation

bool almostEqualRelativeI(double a, double b, int decimalPlaces) =>
    almostEqualNormRelativeI(a, b, a - b, decimalPlaces);