function BigInteger::quotientAndRemainder
Returns the quotient and remainder of the division of this number by the given one.
@psalm-return array{BigInteger, BigInteger}
Parameters
BigNumber|int|float|string $that The divisor. Must be convertible to a BigInteger.:
Return value
BigInteger[] An array containing the quotient and the remainder.
Throws
DivisionByZeroException If the divisor is zero.
File
-
vendor/
brick/ math/ src/ BigInteger.php, line 538
Class
- BigInteger
- An arbitrary-size integer.
Namespace
Brick\MathCode
public function quotientAndRemainder(BigNumber|int|float|string $that) : array {
$that = BigInteger::of($that);
if ($that->value === '0') {
throw DivisionByZeroException::divisionByZero();
}
[
$quotient,
$remainder,
] = Calculator::get()->divQR($this->value, $that->value);
return [
new BigInteger($quotient),
new BigInteger($remainder),
];
}