Creates a new CheckedBigInt. with custom boundaries
initial value
the set boundaries for the instance
const a = new CheckedBigInt(1n, {min: 1n, max: 10n})
Creates a new CheckedBigInt. with a specific bit size and signedness
initial value
the bit size of the integer
whether the integer is signed or not
const a = new CheckedBigInt(1n /* value */, 8 /*bits*/, false/*unsigned*/)
Readonly
boundariesReadonly
valueAdd another integer to this integer, checking for overflow.
The integer to add.
A new CheckedBigInt with the result of the addition.
RangeError If the result of the addition would exceed the bit size.
const a = i8(1n).add(1n) // 2
const b = i8(127n).add(1n) // throws RangeError
Divide this integer by another integer, checking for overflow.
The integer to divide by.
A new CheckedBigInt with the result of the division.
RangeError If the result of the division would exceed the bit size.
RangeError If the divisor is zero.
Multiply this integer by another integer, checking for overflow.
The integer to multiply by.
A new CheckedBigInt with the result of the multiplication.
RangeError If the result of the multiplication would exceed the bit size.
Power this integer to another integer, checking for overflow.
The integer to power by.
A new CheckedBigInt with the result of the power.
RangeError If the result of the power would exceed the bit size.
Remainder of the division of this integer by another integer, checking for overflow.
The integer to divide by.
A new CheckedBigInt with the result of the remainder.
RangeError If the result of the remainder would exceed the bit size.
RangeError If the divisor is zero.
Bitwise shift left this integer by another integer, checking for overflow.
The integer to shift by.
A new CheckedBigInt with the result of the shift.
RangeError If the number of bits is negative.
RangeError If the resulting number would exceed the bit size.
Bitwise shift right this integer by another integer, checking for overflow.
The integer to shift by.
A new CheckedBigInt with the result of the shift.
RangeError If the number of bits is negative.
RangeError If bits is greater than the bit size.
Subtract another integer from this integer, checking for overflow.
The integer to subtract.
A new CheckedBigInt with the result of the subtraction.
RangeError If the result of the subtraction would exceed the bit size.
Generated using TypeDoc
A class that represents a signed or unsigned integer of a specific bit size.