Create a new instance, don't use this directly. Use the .from
factory method instead.
If the value over- or under-flows the integer type.
The underlying BN.js instance – don't modify this
directly – take a copy first using .clone()
.
Static
abiStatic
backgroundStatic
broadcastStatic
byteStatic
isNumber as bytes in little endian (matches memory layout in C++ contract).
Static
maxLargest value that can be represented by this integer type.
Static
minSmallest value that can be represented by this integer type.
Non-mutating add.
Mutating divide.
Optional
behavior: DivisionBehaviorHow to handle the remainder, default is to floor (round down).
When dividing by zero.
Non-mutating divide.
Optional
behavior: DivisionBehaviorHow to handle the remainder, default is to floor (round down).
When dividing by zero.
Greater than comparision operator
Greater than or equal comparision operator
Less than comparision operator
Less than or equal comparision operator
Non-mutating multiply.
Non-mutating subtract.
Called when encoding to binary abi format.
Static
abiStatic
addAdd lhs
to rhs
and return the resulting value.
Static
divDivide lhs
by rhs
and return the quotient, dropping the remainder.
Optional
overflow: OverflowBehaviorWhen dividing by zero.
Static
divDivide lhs
by rhs
and return the quotient + remainder rounded up to the closest integer.
Optional
overflow: OverflowBehaviorWhen dividing by zero.
Static
divDivide lhs
by rhs
and return the quotient + remainder rounded to the closest integer.
Optional
overflow: OverflowBehaviorWhen dividing by zero.
Static
fromCreate a new instance from value.
Value to create new Int instance from, can be a string, number, little-endian byte array or another Int instance.
Optional
overflow: OverflowBehaviorHow to handle integer overflow, default behavior is to throw.
Optional
overflow: OverflowBehaviorStatic
fromABIStatic
gtStatic
gteStatic
ltStatic
lteStatic
mulMultiply lhs
by rhs
and return the resulting value.
Optional
overflow: OverflowBehaviorStatic
randomStatic
subAdd lhs
to rhs
and return the resulting value.
Optional
overflow: OverflowBehavior
Binary integer with the underlying value represented by a BN.js instance. Follows C++11 standard for arithmetic operators and conversions.
Note
This type is optimized for correctness not speed, if you plan to manipulate integers in a tight loop you're advised to use the underlying BN.js value or convert to a JavaScript number first.