compare method

int compare(
  1. double other, {
  2. double precision = precisionErrorTolerance,
})

Implementation

int compare(double other, {double precision = precisionErrorTolerance}) {
  if (isNaN || other.isNaN) {
    throw UnsupportedError('Compared with Infinity or NaN');
  }
  final double n = this - other;
  if (n.abs() < precision) {
    return 0;
  }
  return n < 0 ? -1 : 1;
}