function BigInteger::remainder
Returns the remainder of the division of this number by the given one.
The remainder, when non-zero, has the same sign as the dividend.
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 510
Class
- BigInteger
- An arbitrary-size integer.
Namespace
Brick\MathCode
public function remainder(BigNumber|int|float|string $that) : BigInteger {
$that = BigInteger::of($that);
if ($that->value === '1') {
return BigInteger::zero();
}
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
$remainder = Calculator::get()->divR($this->value, $that->value);
return new BigInteger($remainder);
}