ceil method

BigRational ceil(
  1. dynamic toBigInt
)

Rounds this BigRational towards positive infinity and returns the result as a BigRational.

Returns a new BigRational representing the ceiling of this BigRational.

Implementation

BigRational ceil(toBigInt) {
  final BigInt divmod = _truncate;
  final BigInt remind = _remainder;
  BigInt ceil;

  if (remind == _zero || divmod.isNegative) {
    ceil = divmod;
  } else {
    ceil = divmod + _one;
  }

  return BigRational._(ceil, _one);
}