Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

u64

64-bit unsigned integer: 0 to 18,446,744,073,709,551,615.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

These examples describe the Development language contract. They are not a claim that every workflow is supported by the current public preview. Declaration excerpts belong inside a function unless a full module is shown.

Range and representation

u64 is a fixed-width unsigned integer. Its width does not depend on pointer size.

Range and representation
PropertyValue
Storage64 bits / 8 bytes
Minimum0
Maximum18,446,744,073,709,551,615
let Minimum: u64 = 0_u64;
let Maximum: u64 = 18446744073709551615_u64;

Literals and inference

A fitting integer literal can take u64 from context; _u64 selects it explicitly. Unconstrained integer literals default to i32; an explicit suffix removes that ambiguity. Decimal, binary, octal and hexadecimal integer spellings are available. An out-of-range literal is a compile-time error; even an unsigned literal does not silently wrap.

let Count: u64 = 42;
let Explicit = 42_u64;
let Bits: u64 = 0x2A;
// Rejected: let Outside: u64 = 18446744073709551616;

Arithmetic, bits and failure

Ordinary addition, subtraction and multiplication wrap modulo 2^64. Subtracting one from zero produces 18,446,744,073,709,551,615. Division and remainder operate on nonnegative integers. Unary negation is not a built-in unsigned operation. Division or remainder by zero fatal-traps. .CheckedAdd, .CheckedSub and .CheckedMul return an optional result. +%, -%, *% select wrapping; +|, -|, *| select saturation. Bitwise operations and shifts are supported. Ordinary shift counts must be 0 through 63; right shift zero-fills.

let Maximum: u64 = 18446744073709551615_u64;
let Missing: u64? = Maximum.CheckedAdd(1); // none
let Clamped: u64 = Maximum +| 1; // Maximum
let Wrapped: u64 = Maximum +% 1; // 0
let Bits: u64 = 1_u64 << 2; // 4

Conversions and mixed expressions

Implicit widening stays within the unsigned family. There is no implicit signed/unsigned or integer/float conversion. Explicit as checks the destination range and fatal-traps on failure; as? returns none instead. Narrowing never silently truncates. Binary operations use a common reachable same-family type; compound assignment keeps its left type.

let Value: u64 = 42;
let Wider: u128 = Value; // Exact implicit widening.
let Restored: u64? = Wider as? u64;

See all primitive types and literals and user-defined suffixes.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library