Odin is a strongly typed language, and it follows for the most part int64, int32, and their float counter parts.


Summary Table

Type Precision Limit (Exact) What happens after?
i64/u64 ~18.4 Quintillion It wraps/overflows
f64 ~ 9 Quadrillion It skips odd numbers, then larger gaps.
f32 ~ 16.7 Million It connot represent the next whole number.

1. Integers (Exact Precision)

Integers in Odin have perfect precision until they hit their maximum capacity. Once they exceed that limit, they will "wrap around" also known has overflow rather than lose precision.

The largest standard integer is u64 (unsigned 64-bit).


2. Floating-Point Numbers (The "Drift')

Both f32 and f64 have a lot less precision than Integers do to the . taking up space in the 32 or 64bit space(The mantissa and the scale).

f32 (Single Precision)

You start losing "integer precision"[1] after 16,777,216(224).

f64 (Double Precision / Default)

This is what Odin uses for literal decimals (e.g. x := 1.0). You lose integer precision after 9,007,199,254,740,992 (253).


What to do if you need to bigger?

There is a library at core:math/big that handles that.


  1. The ability to represent every while number exactly. ↩︎