# Fraction

The base class which all subsequent fraction classes extend. Not meant to be used directly.

constructor(numerator: BigintIsh, denominator: BigintIsh = ONE)

- numerator (JSBI type)
- denominator (JSBI type)

Performs floor division.

quotient(): JSBI

Gets the remainder after floor division.

remainder(): Fraction

invert(): Fraction

add(other: Fraction | BigintIsh): Fraction

subtract(other: Fraction | BigintIsh): Fraction

lessThan(other: Fraction | BigintIsh): boolean

equalTo(other: Fraction | BigintIsh): boolean

greaterThan(other: Fraction | BigintIsh): boolean

multiply(other: Fraction | BigintIsh): Fraction

divide(other: Fraction | BigintIsh): Fraction

Formats a fraction to the specified number of significant digits.

toSignificant(

significantDigits: number,

format: object = { groupSeparator: '' },

rounding: Rounding = Rounding.ROUND_HALF_UP

): string

Formats a fraction to the specified number of decimal places.

toFixed(

decimalPlaces: number,

format: object = { groupSeparator: '' },

rounding: Rounding = Rounding.ROUND_HALF_UP

): string

Last modified 2yr ago