@waves/bignumber
A Long class for representing a 64 bit two's-complement value.
Usage
The class is compatible with CommonJS and AMD loaders and is exposed globally as BigNumber
if neither is available.
var BigNumber = require("@waves/bignumber");
var longVal = new BigNumber('121231321321321313213');
console.log(longVal.toString());
...
API
Constructor
- new BigNumber(long:
number | string | BigNumber
)
Constants
-
BigNumber.MAX_VALUE: BigNumber
Maximum signed value.
-
BigNumber.MIN_VALUE: BigNumber
Minimum signed value.
-
BigNumber.MAX_UNSIGNED_VALUE: BigNumber
Maximum unsigned value.
Methods
-
BigNumber#add(addend: Long | number | string
): BigNumber
Returns the sum of this and the specified Long.
-
BigNumber#div(divisor: Long | number | string
): BigNumber
Returns this Long divided by the specified.
-
BigNumber#eq(other: Long | number | string
): boolean
Tests if this Long's value equals the specified's.
-
BigNumber#gt(other: Long | number | string
): boolean
Tests if this Long's value is greater than the specified's.
-
BigNumber#gte/ge(other: Long | number | string
): boolean
Tests if this Long's value is greater than or equal the specified's.
-
BigNumber#isEven(): boolean
Tests if this Long's value is even.
-
BigNumber#isNegative(): boolean
Tests if this Long's value is negative.
-
BigNumber#isOdd(): boolean
Tests if this Long's value is odd.
-
BigNumber#isPositive(): boolean
Tests if this Long's value is positive.
-
BigNumber#isZero(): boolean
Tests if this Long's value equals zero.
-
BigNumber#lt(other: Long | number | string
): boolean
Tests if this Long's value is less than the specified's.
-
BigNumber#lte/le(other: Long | number | string
): boolean
Tests if this Long's value is less than or equal the specified's.
-
BigNumber#mod(divisor: Long | number | string
): BigNumber
Returns this Long modulo the specified.
-
BigNumber#mul(multiplier: Long | number | string
): BigNumber
Returns the product of this and the specified Long.
-
BigNumber#toBytes(le?: boolean
): number[]
Converts this Long to its byte representation.
Building
To build an UMD bundle to dist/index.js
, run:
$> npm install @waves/bignumber
Running the tests:
$> npm test