Fraction
The base class which all subsequent fraction classes extend. Not meant to be used directly.
Constructor
constructor(numerator: BigintIsh, denominator: BigintIsh = ONE)Properties
numerator (JSBI type)
denominator (JSBI type)
Methods
quotient
Performs floor division.
quotient(): JSBIremainder
Gets the remainder after floor division.
remainder(): Fractioninvert
invert(): Fractionadd
add(other: Fraction | BigintIsh): Fractionsubtract
subtract(other: Fraction | BigintIsh): FractionlessThan
lessThan(other: Fraction | BigintIsh): booleanequalTo
equalTo(other: Fraction | BigintIsh): booleangreaterThan
greaterThan(other: Fraction | BigintIsh): booleanmultiply
multiply(other: Fraction | BigintIsh): Fractiondivide
divide(other: Fraction | BigintIsh): FractiontoSignificant
Formats a fraction to the specified number of significant digits.
toSignificant(
significantDigits: number,
format: object = { groupSeparator: '' },
rounding: Rounding = Rounding.ROUND_HALF_UP
): stringtoFixed
Formats a fraction to the specified number of decimal places.
toFixed(
decimalPlaces: number,
format: object = { groupSeparator: '' },
rounding: Rounding = Rounding.ROUND_HALF_UP
): stringLast updated
Was this helpful?