Skip to content

std/i64

std/i64 — signed 64-bit integer receiver methods. Counterpart to std/i32 for the wider type. Methods are migrated here from the auto-injected prelude per docs/PRELUDE-TO-MODULES.md. The auto-prelude declares import "std/i64"; so existing programs that call n.abs() / .gcd(…) / etc. on an i64 continue to work unchanged.

pub function (n: i64) abs(): i64

(n: i64) abs() — absolute value. i64::MIN wraps to itself (no i128 to widen into); matches Rust’s wrapping_abs. Callers needing exact handling should pre-check n != i64::MIN.

pub function (n: i64) min(other: i64): i64
pub function (n: i64) max(other: i64): i64
pub function (n: i64) clamp(lo: i64, hi: i64): i64
pub function (n: i64) pow(exp: i32): i64

(n: i64) pow(exp) — same exponentiation-by-squaring shape as the i32 version. Overflow wraps silently; callers needing exact handling should check exp and n.abs() against i64::MAX’s bit width.

pub function (n: i64) gcd(other: i64): i64
pub function (n: i64) lcm(other: i64): i64
pub function (n: i64) to_string(): string

(n: i64) to_string() — decimal representation via the pure-i64 formatter helper __int_to_string_u64.

pub function (n: i64) is_even(): boolean

(n: i64) is_even() / is_odd() — parity helpers matching the i32 versions in std/i32.

pub function (n: i64) is_odd(): boolean