BigInteger

Inherits from: Object

Arbitrary-precision integers for values that exceed SmallInteger range.

BigInteger is created automatically when SmallInteger arithmetic overflows the 48-bit range. You never need to create BigIntegers explicitly — they appear transparently from operations like factorial on large numbers, exponentiation, or simply adding beyond SmallInteger limits.

BigInteger supports all the same arithmetic (+, -, *, /, \\, //), comparison (<, >, <=, >=, =), and bitwise (bitAnd:, bitOr:, bitXor:, bitShift:) operators as SmallInteger. Mixed BigInteger/SmallInteger operations are handled automatically — the SmallInt operand is promoted. Mixed BigInteger/Float operations produce Float results.

If a BigInteger result fits back in the SmallInteger range, it is automatically demoted for efficiency.

Test
20 factorial class name >>> #BigInteger
20 factorial > 0 >>> true
20 factorial printString >>> '2432902008176640000'

Instance Methods

primitives

*

Return the product of the receiver and the argument.

+

Return the sum of the receiver and the argument.

-

Return the difference of the receiver and the argument.

/

Return the integer quotient (truncated toward zero).

//

Return the integer quotient (truncated toward negative infinity).

<

Return true if the receiver is less than the argument.

<=

Return true if the receiver is less than or equal to the argument.

=

Return true if the receiver equals the argument.

>

Return true if the receiver is greater than the argument.

>=

Return true if the receiver is greater than or equal to the argument.

\\

Return the remainder.

bitAnd:

Return the bitwise AND.

bitOr:

Return the bitwise OR.

bitShift:

Shift left by count bits (negative shifts right).

bitXor:

Return the bitwise XOR.

hash

Return a hash value for the receiver.

primAsFloat
primPrintString
primSign

uncategorized

abs

Return the absolute value.

asFloat

Convert to Float (may lose precision for very large values).

Test
20 factorial asFloat class name >>> #Float
asSmallInt

Convert to SmallInteger (truncates if too large).

isZero

Return true if the receiver is zero.

negated

Return the negation of the receiver.

printString

Return a human-readable string representation.

sign

Return -1, 0, or 1 indicating the sign.

Test
20 factorial sign >>> 1