Hide menu
Loading...
Searching...
No Matches
Ratio

Holds the ratio of 2 positive integers in the form of (n:m).

Can be used to define the scale factor in certain situations. The numerator and denominator are not reduced, they are stored as is.

Constructors

new Ratio()

new Ratio(numerator?, denominator?): Ratio

Throws exception if denominator is 0.

Parameters

numerator?

number

Numerator of the ratio.

denominator?

number

Denominator of the ratio.

Returns

Ratio

Warning

0 does not make sense for and should not be passed to either of the parameters.

Accessors

denominator

Get Signature

get denominator(): number

Returns the denominator of the ratio (i.e. m from (n:m)).

Returns

number

Set Signature

set denominator(denominator): void

Sets the denominator of the ratio (i.e. m from (n:m)).

Throws exception if denominator is 0.

Warning

0 does not make sense for and should not be supplied to this parameter.

Parameters

denominator

number

Denominator of the ratio.

Returns

void


numerator

Get Signature

get numerator(): number

Returns the numerator of the ratio (i.e. n from (n:m)).

Returns

number

Set Signature

set numerator(numerator): void

Sets the numerator of the ratio (i.e. n from (n:m)).

Warning

0 does not make sense for and should not be supplied to this parameter.

Parameters

numerator

number

Numerator of the ratio.

Returns

void

Methods

toNumber()

toNumber(): number

Converts the ratio to number.

Returns

number