public functiontoBigInteger() : BigInteger {
$simplified = $this->simplified();
if (!$simplified->denominator
->isEqualTo(1)) {
thrownewRoundingNecessaryException('This rational number cannot be represented as an integer value without rounding.');
}
return$simplified->numerator;
}