The underlying BN.js instance – don't modify this
directly – take a copy first using .clone()
.
Static
abiStatic
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.
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).
Compare two integers, if strict is set to true the test will only consider integers of the exact same type. I.e. Int64.from(1).equals(UInt64.from(1)) will return false.
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.
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: OverflowBehaviorGenerated using TypeDoc
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.