Skip to main content
Helpful?

Fraction

@uniswap/sdk-core / Exports / Fraction

Class: Fraction

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new Fraction(numerator, denominator?)

Parameters

NameType
numeratorBigintIsh
denominatorBigintIsh

Defined in

entities/fractions/fraction.ts:28

Properties

denominator

Readonly denominator: default

Defined in

entities/fractions/fraction.ts:26


numerator

Readonly numerator: default

Defined in

entities/fractions/fraction.ts:25

Accessors

asFraction

get asFraction(): Fraction

Helper method for converting any super class back to a fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:154


quotient

get quotient(): default

Returns

default

Defined in

entities/fractions/fraction.ts:42


remainder

get remainder(): Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:47

Methods

add

add(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:55


divide

divide(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:115


equalTo

equalTo(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Defined in

entities/fractions/fraction.ts:91


greaterThan

greaterThan(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Defined in

entities/fractions/fraction.ts:99


invert

invert(): Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:51


lessThan

lessThan(other): boolean

Parameters

NameType
otherBigintIsh | Fraction

Returns

boolean

Defined in

entities/fractions/fraction.ts:83


multiply

multiply(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:107


subtract

subtract(other): Fraction

Parameters

NameType
otherBigintIsh | Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:69


toFixed

toFixed(decimalPlaces, format?, rounding?): string

Parameters

NameTypeDefault value
decimalPlacesnumberundefined
formatobjectundefined
roundingRoundingRounding.ROUND_HALF_UP

Returns

string

Defined in

entities/fractions/fraction.ts:138


toSignificant

toSignificant(significantDigits, format?, rounding?): string

Parameters

NameTypeDefault value
significantDigitsnumberundefined
formatobjectundefined
roundingRoundingRounding.ROUND_HALF_UP

Returns

string

Defined in

entities/fractions/fraction.ts:123


tryParseFraction

Static Private tryParseFraction(fractionish): Fraction

Parameters

NameType
fractionishBigintIsh | Fraction

Returns

Fraction

Defined in

entities/fractions/fraction.ts:33

Helpful?