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.
Cast this integer to other type.
Optional
overflow: OverflowBehaviorHow to handle overflow, default is to preserve bit-pattern (C++11 behavior).
Mutating divide.
When dividing by zero.
Optional
behavior: DivisionBehaviorHow to handle the remainder, default is to floor (round down).
Non-mutating divide.
When dividing by zero.
Optional
behavior: DivisionBehaviorHow to handle the remainder, default is to floor (round down).
Non-mutating multiply.
Non-mutating subtract.
Called when encoding to binary abi format.
Static
abiStatic
addAdd lhs
to rhs
and return the resulting value.
Optional
overflow: OverflowBehaviorStatic
divDivide lhs
by rhs
and return the quotient, dropping the remainder.
When dividing by zero.
Optional
overflow: OverflowBehaviorStatic
divDivide lhs
by rhs
and return the quotient + remainder rounded up to the closest integer.
When dividing by zero.
Optional
overflow: OverflowBehaviorStatic
divDivide lhs
by rhs
and return the quotient + remainder rounded to the closest integer.
When dividing by zero.
Optional
overflow: OverflowBehaviorStatic
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
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.