The BigInteger type provides arbitrary-precision whole numbers. Unlike the standard 64-bit Integer, a BigInteger can grow to represent any value, limited only by the available system memory.
Big integers are essential for cryptography, high-precision scientific calculations, or any domain where values might exceed the $2^{63}-1$ limit of standard integers.
var big := BigInteger('1234567890123456789012345678901234567890');
big := big * 2;
PrintLn(big.ToString); 2469135780246913578024691357802469135780
While there is no native "BigInt" literal suffix (like 100n in JS), you can initialize them from strings or standard integers using the BigInteger() constructor-style call.
var b1 := BigInteger(100);
var b2 := BigInteger('1' + '0'.Dupe(50)); // 1 followed by 50 zeros
PrintLn(b1.ToString); 100
BigInteger supports all standard arithmetic and comparison operators.
+, -, *, div, mod=, <>, <, >, <=, >=and, or, xor, not, shl, shrvar a := BigInteger(1000);
var b := BigInteger(3);
var res := (a div b); // 333
PrintLn(res.ToString); 333
The BigInteger type includes several useful methods for common mathematical operations.
IsEven / IsOdd: Check parity.IsPrime: Checks if the number is prime (probabilistic for large numbers).Abs: Returns the absolute value.Pow(exponent): Raises the number to a power.ModPow(exponent, modulus): Efficient modular exponentiation (critical for RSA/DH).Gcd(other): Greatest Common Divisor.For a complete list of BigInteger methods, see the Math API Reference.