function BigInteger::mod
Returns the modulo of this number and the given one.
The modulo operation yields the same result as the remainder operation when both operands are of the same sign, and may differ when signs are different.
The result of the modulo operation, when non-zero, has the same sign as the divisor.
Parameters
BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.:
Throws
DivisionByZeroException If the divisor is zero.
File
-
vendor/
brick/ math/ src/ BigInteger.php, line 566
Class
- BigInteger
- An arbitrary-size integer.
Namespace
Brick\MathCode
public function mod(BigNumber|int|float|string $that) : BigInteger {
$that = BigInteger::of($that);
if ($that->value === '0') {
throw DivisionByZeroException::modulusMustNotBeZero();
}
$value = Calculator::get()->mod($this->value, $that->value);
return new BigInteger($value);
}