# [Ride v5] BigInt
⚠️ This is the documentation for the Standard library version 5. We recommend to use version 6. Go to version 6
BigInt
is a special numeric data type designed to handle values outside the range of Int and to perform high accuracy calculations.
BigInt
variable has a size of 64 bytes (512 bits) and contains an integer between –2511 to 2511–1, inclusive. The weight of the value is 64.
⚠️ A BigInt
variable can only be used inside a script. A callable function does not accept arguments of BigInt
type and does not return a value of BigInt
type. You can pass a big integer value as a string, then use the parseBigInt
or parseBigIntValue
functions.
# BigInt Operations
The following operators support BigInt
values:
- Arithmetic operators: +, -, *, /, %, unary minus.
- Comparison operators: <, >, <=, and >=.
- Equality operators: == and !=.
Both operands should be BigInt
.
The following functions operate BinInt
values:
- fraction(BigInt, BigInt, BigInt): BigInt
- fraction(BigInt, BigInt, BigInt, Union): BigInt
- log(BigInt, Int, BigInt, Int, Int, Union): BigInt
- max(List[BigInt]): BigInt
- median(List[BigInt]): BigInt
- min(List[BigInt]): BigInt
- pow(BigInt, Int, BigInt, Int, Int, Union): BigInt
- parseBigInt(String): BigInt|Unit
- parseBigIntValue(String): BigInt
- toBigInt(ByteVector): BigInt
- toBigInt(ByteVector, Int, Int): BigInt
- toBigInt(Int): BigInt
- toBytes(BigInt): ByteVector
- toInt(BigInt): Int
- toString(BigInt): String