Skip to content

Int

128-bit signed integers.

The rounding methods return the receiver unchanged.

Inherits from: Num

Constructor

Int()

Converts a value to an integer.

Int accepts an integer, a boolean, or an integral float. It rejects fractional floats and interpretive conversions such as parsing strings.

assert_eq (Int true) 1
assert_eq (Int 3.0) 3

The lowercase int function performs coercion and parsing:

assert_eq (int "42") 42
assert_eq (int 3.14) 3

Fields

MAX @ Int [get, set]

Largest representable integer.

MIN @ Int [get, set]

Smallest representable integer.

Methods

(band) other -> Int

Computes bitwise AND.

Parameters

NameTypeDescription
other (Int | Bool)

(bnot)() -> Int

Computes bitwise NOT.

(bor) other -> Int

Computes bitwise OR.

Parameters

NameTypeDescription
other (Int | Bool)

(bxor) other -> Int

Computes bitwise XOR.

Parameters

NameTypeDescription
other (Int | Bool)

(shl) other -> Int

Shifts left.

Parameters

NameTypeDescription
other Int

(shr) other -> Int

Shifts right arithmetically, sign-extending negative values.

Parameters

NameTypeDescription
other Int