Floating Point: f32 and f64
Work with fractional numbers.
Numbers with a Fraction
When you need decimals, Zig offers floating-point types. They store fractional values like 3.14 instead of whole numbers only.
f64 Is the Common Choice
The f64 type holds a double-precision float using 64 bits. It is the usual default when you want accuracy and plenty of range.
const pi: f64 = 3.14159;All lessons in this course
- Sized Integers: i32, u8, usize
- Floating Point: f32 and f64
- bool, void, and the Comptime Types
- Number Literals and Underscores