function BigRational::__construct
Protected constructor. Use a factory method to obtain an instance.
Parameters
BigInteger $numerator The numerator.:
BigInteger $denominator The denominator.:
bool $checkDenominator Whether to check the denominator for negative and zero.:
Throws
DivisionByZeroException If the denominator is zero.
File
-
vendor/
brick/ math/ src/ BigRational.php, line 40
Class
- BigRational
- An arbitrarily large rational number.
Namespace
Brick\MathCode
protected function __construct(BigInteger $numerator, BigInteger $denominator, bool $checkDenominator) {
if ($checkDenominator) {
if ($denominator->isZero()) {
throw DivisionByZeroException::denominatorMustNotBeZero();
}
if ($denominator->isNegative()) {
$numerator = $numerator->negated();
$denominator = $denominator->negated();
}
}
$this->numerator = $numerator;
$this->denominator = $denominator;
}