0PricingLogin
Zig Academy · Lesson

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

  1. Sized Integers: i32, u8, usize
  2. Floating Point: f32 and f64
  3. bool, void, and the Comptime Types
  4. Number Literals and Underscores
← Back to Zig Academy