operator ~/ method

BigRational operator ~/(
  1. BigRational other
)

Performs integer division on this BigRational by the given BigRational and returns the result as a BigRational.

other The divisor BigRational. Returns a new BigRational representing the integer division of this BigRational by the given BigRational.

Implementation

BigRational operator ~/(BigRational other) {
  BigInt divmod = _truncate;
  BigInt rminder = _remainder;
  BigInt floor;

  if (rminder == _zero || !divmod.isNegative) {
    floor = divmod;
  } else {
    floor = divmod - _one;
  }
  return BigRational._(floor, _one);
}