isSmallerD function

bool isSmallerD (double a, double b, double maximumAbsoluteError)

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

Implementation

bool isSmallerD(double a, double b, double maximumAbsoluteError) {
  // 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 compareToD(a, b, maximumAbsoluteError) < 0;
}