Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Numeric Types

Like all type expressions, this expression produces a value of the type type.

Numeric-typed values are either integer or floating-point numbers, with a specific representation, precision, and range of representable values dependent on the type itself.

Representation

  1. i8, i16, i32, and i64 are signed binary integers in two's complement representation, exactly 8, 16, 32, and 64 bits in size respectively.
  2. u8, u16, u32, and u64 are unsigned binary integers, exactly 8, 16, 32, and 64 bits in size respectively.
  3. f32 and f64 are IEEE 754 single-precision and double-precision binary floating-point numbers respectively.

Syntax

numeric_type = i8  | i16 | i32 | i64
               | u8  | u16 | u32 | u64
               | f32 | f64 ;