Static
fromThe number to convert to a fraction.
A new Fraction object representing the number as a fraction.
const fraction = Fraction.fromIntegral(1.75);
console.log(fraction.numerator, fraction.denominator); // Output: 7 4
Static
toConverts the fraction to an integral number.
The integral value of the fraction.
const fraction = new Fraction(5, 2);
const integral = fraction.toIntergral();
console.log(integral); // Output: 2.5
Generated using TypeDoc
Creates a new Fraction object from an integral number.