> LeekScript
BigInteger is a type of LeekScript added in update 2.48. It is a new primitive that is compatible with the other existing types, and is mainly used to make it easier to build and optimize bitmaps.
A BigInteger is an integer that behaves almost like an Integer, but can be much larger: a classic Integer is limited to 64 bits (263-1), whereas a BigInteger can hold up to 1 048 576 bits (220), i.e. about 315 000 decimal digits. Beyond this cap, the computation fails with an OUT_OF_MEMORY error.
Note: This type is not meant to replace the existing types everywhere (as it costs more operations and uses more memory). It is not useful for solving the riddle of the Evil Pumpkin.
The letter L is used to mark a number as a BigInteger. The _ separator is accepted in literals to make them more readable:
var a = 1L var b = 0b111L big_integer c = 5 big_integer d = -3L var e = 1_000_000L
The BigInteger() constructor creates a BigInteger equal to 0, and the instanceof operator lets you test the type of a value:
var x = BigInteger() debug(x instanceof BigInteger) // true
Be careful, a large number is not detected automatically: without the L suffix, a literal too large for an Integer becomes a Real (with loss of precision). Only the L suffix or the big_integer type create a BigInteger:
var a = 123445321324234567895431235648945674894561564523489756489 // Real: 1.2344532132423457E56 var b = 1 >> operator behaves like >> (arithmetic shift: the sign is preserved). The / operator works like on other numbers and returns a Real (15L / 4L equals 3.75); only \ performs integer division (15L \ 4L equals 3`). An operation involving a BigInteger most often yields a result of type BigInteger:
var a = 5.0 + 5L // BigInteger var b = 123456789123456789L % 234567 // BigInteger
The cost in operations and memory is proportional to the size of the operands — and to the product of the sizes of both operands for , \, % and *:
var a = 2L * 200_000 // about 1 221 000 operations: the result is 200 001 bits long var b = 2L * 200_000_000 // costs almost nothing... because it crashes: the result would exceed the 1 048 576-bit cap (OUT_OF_MEMORY)
Very large numbers are truncated to reduce computations and avoid flooding the display (the binString and hexString functions display them in full, with an adjusted cost):
debug(1L >> and >>`.
bitCount(0b1101L) equals 3;trailingZeros(24L) equals 3;signum(-42L) equals -1.Impossible de charger les données du jeu.
Vérifiez votre connexion et réessayez.