remainder method

BigInt? remainder(
  1. BigInt other
)

Returns the remainder of the truncating division of this by other.

The result r of this operation satisfies: this == (this ~/ other) * other + r. As a consequence the remainder r has the same sign as the divider this.

Example:

print(Obj(BigInt.from(5)).remainder(BigInt.from(3))); // 2
print(Obj(BigInt.from(-5)).remainder(BigInt.from(3))); // -2
print(Obj(BigInt.from(5)).remainder(BigInt.from(-3))); // 2
print(Obj(BigInt.from(-5)).remainder(BigInt.from(-3))); // -2

Implementation

BigInt? remainder(BigInt other) => value?.remainder(other);