round method

BigInt round()

Returns the BigInt value closest to this number.

Rounds away from zero when there is no closest integer: (3.5).round() == 4 and (-3.5).round() == -4.

Implementation

BigInt round() {
  final abs = this.abs();
  final absBy10 = abs * _r10;
  var r = abs.truncate();
  if (absBy10 % _r10 >= _r5) r += _i1;
  return _isNegative ? -r : r;
}