round method

int round()

Rounds this fraction to an integer.

Implementation

int round() {
  if (!isFinite) return toDouble().round();
  final absA = a.abs();
  final q = absA ~/ b;
  final r = absA % b;
  final res = 2 * r >= b ? q + 1 : q;
  return a < 0 ? -res : res;
}