function BigRational::nd
Creates a BigRational out of a numerator and a denominator.
If the denominator is negative, the signs of both the numerator and the denominator will be inverted to ensure that the denominator is always positive.
@psalm-pure
Parameters
BigNumber|int|float|string $numerator The numerator. Must be convertible to a BigInteger.:
BigNumber|int|float|string $denominator The denominator. Must be convertible to a BigInteger.:
Throws
NumberFormatException If an argument does not represent a valid number.
RoundingNecessaryException If an argument represents a non-integer number.
DivisionByZeroException If the denominator is zero.
File
-
vendor/
brick/ math/ src/ BigRational.php, line 80
Class
- BigRational
- An arbitrarily large rational number.
Namespace
Brick\MathCode
public static function nd(BigNumber|int|float|string $numerator, BigNumber|int|float|string $denominator) : BigRational {
$numerator = BigInteger::of($numerator);
$denominator = BigInteger::of($denominator);
return new BigRational($numerator, $denominator, true);
}