ethers.js/docs/api/utils/fixednumber
2019-08-21 01:53:47 -04:00
..
index.html Added initial flatworm documentation stubs. 2019-08-21 01:53:47 -04:00
README.md Added initial flatworm documentation stubs. 2019-08-21 01:53:47 -04:00

FixedNumber

Types

FixedFormat

TODO

"fixed"

A shorthand for fixed128x80.

Creating Instances

The FixedNumber constructor cannot be called directly. There are several static methods for creating a FixedNumber.

BigNumber . from ( value [ , format="fixed" ] ) => FixedNumber

Returns an instance of a FixedNumber for value as a format.

BigNumber . fromBytes ( aBytesLike [ , format="fixed" ] ) => FixedNumber

Returns an instance of a FixedNumber for value as a format.

BigNumber . fromString ( value [ , format="fixed" ] ) => FixedNumber

Returns an instance of a FixedNumber for value as a format. The value must not contain more decimals than the format permits.

BigNumber . fromValue ( value [ , decimals=0 [ , format="fixed" ] ] ) => FixedNumber

Returns an instance of a FixedNumber for value with decimals as a format.

Properties

fixednumber . format

The FixedFormat of fixednumber.

Methods

Math Operations

fixednumber . addUnsafe ( otherValue ) => FixedNumber

Returns a new FixedNumber with the value of fixedvalue + otherValue.

fixednumber . subUnsafe ( otherValue ) => FixedNumber

Returns a new FixedNumber with the value of fixedvalue otherValue.

fixednumber . mulUnsafe ( otherValue ) => FixedNumber

Returns a new FixedNumber with the value of fixedvalue × otherValue.

fixednumber . divUnsafe ( otherValue ) => FixedNumber

Returns a new FixedNumber with the value of fixedvalue ÷ otherValue.

fixednumber . round ( [ decimals=0 ] ) => FixedNumber

Returns a new FixedNumber with the value of fixedvalue rounded to decimals.

Conversion

fixednumber . toFormat ( format ) => FixedNumber

Returns a new FixedNumber with the value of fixedvalue with format.

fixednumber . toHexString ( ) => string

Returns a Hexstring representation of fixednumber.

fixednumber . toString ( ) => string

Returns a string representation of fixednumber.

fixednumber . toUnsafeFloat ( ) => float

Returns a floating-point JavaScript number value of fixednumber. Due to rounding in JavaScript numbers, the value is only approximate.

Inspection

BigNumber . isFixedNumber ( value ) => boolean

Returns true if and only if value is a FixedNumber.


Content Hash: ddffbdca7bc7b54726596bd79a88e5df5dc947ff48bd2f93d516bb5b084aa4db