isLargerRelativeD function

bool isLargerRelativeD(
  1. double a,
  2. double b,
  3. double maximumError
)

Compares two doubles and determines if the first value is larger than the second value to within the specified number of decimal places or not.

Implementation

bool isLargerRelativeD(double a, double b, double maximumError) {
  // If A or B are a NAN, return false. NANs are equal to nothing,
  // not even themselves, and thus they're not bigger or
  // smaller than anything either
  if (a.isNaN || b.isNaN) {
    return false;
  }

  return compareToRelativeD(a, b, maximumError) > 0;
}