i64
i64, data type
i64 is a signed 64-bit integer, formerly named long. The name long
remains an alias. Each value occupies 8 bytes, twice the numeric storage of
a number value.
This type is useful for exact integer calculations beyond $2^{24}$, where
number can no longer represent every consecutive integer. Its range is
$-2^{63}$ through $2^{63}-1$.
Supported operations
- Arithmetic:
+,-,*, and/. Integer division truncates toward zero;to.i64(7) / to.i64(2)is3. - Comparisons:
==,!=,<,<=,>, and>=. - Pure functions:
min,max,abs, andtext. - Text interpolation (
"Value: \{x}") and markdown interpolation ("""Value: \{x}"""). - Processes:
sum,avg,min,max,first,last,changed,whichever,same,single, andareSame. - Conversions: to.i64 from
numberorf64; to.number and to.f64 in the other direction.
Examples
base = to.i64(16777216)
next = base + to.i64(1)
show summary "Integer precision" with
text(next) as "i64"
text(to.number(next)) as "number"
The i64 value is 16777217. Converting it to number rounds it to
16777216. The addition is performed after conversion: converting a result
already rounded in number would not recover the missing precision.
Limitations
Writing i64 values to a file is not supported, including through path schemas
or implicit column selection. Convert to number only when the possible
precision loss is acceptable, or use text to export the integer as text.