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) {
  BigInt divmod = _truncate;
  BigInt remind = _remainder;
  BigInt ceil;

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

  return BigRational._(ceil, _one);
}