gnd

The uint64 operation converts a single input value to a 64-bit unsigned integer.

Accepted operand forms

Range check

Conversion succeeds only when the value lies in 0 … 18 446 744 073 709 551 615. If the operand is negative, exceeds that maximum, cannot be parsed as an integer, or is a float with a fractional part, uint64 raises an error. The operation never mutates its input; it returns a new value whose concrete type is 64-bit unsigned integer.

Syntax

[ $destination ] uint64 value

Examples

Convert a large decimal literal:

$big  uint64 18446744073709551615   # $big holds the max uint64 value

Convert a hexadecimal string:

$hex   let "0xFFFFFFFFFFFFFFFF"
$max64 uint64 $hex                 # 18 446 744 073 709 551 615

Convert the current _ in place:

let  1024
uint64                              # same as uint64 _

Overflow triggers an error:

uint64 20000000000000000000         # error: value exceeds uint64 limit

Negative numbers are rejected:

uint64 -7                           # error: negative value not allowed

Fractions are rejected:

uint64 3.0e2                        # ok (300)
uint64 3.14                         # error: fractional part not allowed

uint64 always yields one uint64 value, never rebinds existing variables, and follows Gendo’s single-assignment rule.