primitive-type

Rust u128: 128-bit unsigned integer

`u128` stores nonnegative whole numbers in 128 bits. Its range is 0 through 340,282,366,920,938,463,463,374,607,431,768,211,455. An exact nonnegative value beyond the u64 range. Expected output: 100000000000000000000 Why: The chosen value is representable by u128. Common mistake: Large integers can still overflow at their upper bound.

Formal Syntax & Structure

rust syntaxrust
let name: u128 = integer_literal;

Working Example

Example Snippetrust
fn main() {    let total: u128 = 100000000000000000000;    println!("{total}");}
Rust Reference