ADR-322: A Whole Number May Carry a Scale — K M G T P Decimal, Ki Mi Gi Ti Pi Binary — and an Exponent Is Written e

Status: Accepted Date: October 5, 2026 Answers: how a large count or size is written without twelve digits, first asked by a comptime’s bounds (ADR-321 D11): comptime(steps: 1G, ram: 4Gi) NAME = … Related: ADR-285 D16-D21 (the spellings of a number literal; the radix is a spelling, and a literal is a value; no type suffix; the use decides the type); ADR-150 D3 (no unit suffix: 5s is not a literal)

1. Question

How does a program write a billion, or four gibibytes?

10_000_000_000 and 4_294_967_296 are correct and unreadable, and a digit too many is a factor of ten nobody sees. A count or a size in the billions is ordinary in a program that sizes buffers, bounds a run or limits memory.

2. How others do it

Where Spelling Notes
Rust, Go, Zig, Kotlin, Python 1_000_000_000, 1 << 30 no scale in a literal
Kubernetes quantities 500M, 4Gi decimal K M G T P E, binary Ki Mi Gi Ti Pi Ei (IEC 80000-13)
Java, nginx, systemd -Xmx4g, 4G one letter, read as binary or decimal by convention

What transfers: the IEC split, which says in the spelling whether a G is 10⁹ or 2³⁰. What does not: one letter that means either, by convention.

3. Options, weighed

Option Why it lost
No scale; write the digits a reader counts zeros, and a factor of ten is one keystroke
G alone, binary or decimal by context steps: 1G and ram: 4G would mean 10⁹ and 2³² from one letter
Lower-case scales (k, m) 1m reads as milli, metre or minute
A type suffix (1i64) or a unit (5s) a different thing, declined by ADR-285 and ADR-150 D3 and not reopened: a scale gives a value, not a type or a unit
Exa (E, Ei) now 1E would sit beside 1E5, an exponent in today’s grammar, and it is barely needed: 10E does not fit an i64

4. Decision

D1 — A decimal whole number may end in K, M, G, T or P (10³ to 10¹⁵), or Ki, Mi, Gi, Ti or Pi (2¹⁰ to 2⁵⁰).

1G is 1_000_000_000, 4Gi is 4_294_967_296, 1_500M is 1_500_000_000. The scale is upper-case and stands directly after the last digit.

D2 — A scale is a spelling, and a literal is a value.

As a radix is (ADR-285 D17): 1G is 1000000000 to the checker, the ledger, the fold and a diagnostic, and takes its type from its use, or the first type that holds it where nothing asks (ADR-285 D20-D21). A value its type does not hold is refused as any literal’s is (NK1116); a value wider than a u64 is refused by name.

D3 — Only a decimal whole number takes a scale.

Not 0x…, 0o… or 0b…, where a letter may be a digit, and not a float. A scale anywhere else is the number beside a name it is today (NK1117).

D4 — An exponent is written with a lower-case e.

1e5, 1.5e-4. 1E5 is refused, and the message writes 1e5. Lower case is an exponent and upper case is a scale, so the two never share a letter.

5. Consequences

6. What this does not decide

This site is open source. Improve this page.