JavaScripture
Contribute via GitHub Feedback

BigInt : Object

An arbitrarily large integer value. Allows storing integers larger than what Number allows. Use Number(bigInt) to convert a BigInt to a Number.

BigInt(int : Number) : BigInt

Creates a BigInt for the specified number. int should be between Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER.

Example:

Run

Results:

 

BigInt(int : String) : BigInt

Converts the specified string to a BigInt. Allows constructing BigInts larger than Numbers.

Example:

Run

Results:

 

Instance Methods

asIntN(n : Number, bigInt : BigInt) : BigInt

Truncates bigInt to an n-bit signed integer.

Example:

Run

Results:

 

asUintN(n : Number, bigInt : BigInt) : BigInt

Truncates bigInt to an n-bit unsigned integer.

Example:

Run

Results: