Fixed Point vs. Floating Point: Key Differences, Speed & Precision
Fixed Point stores numbers with a constant number of digits after the decimal; Floating Point lets the decimal move to scale the magnitude, trading range for exactness.
People confuse them because both handle decimals, yet a cashier using a cash register (fixed) sees no rounding error while a game developer watching GPU shaders (floating) sees tiny drifts that turn planets into spaghetti.
Key Differences
Fixed Point keeps the decimal locked; values are exact but range is narrow. Floating Point uses scientific notation (mantissa + exponent) giving vast range but only approximate precision, with rounding quirks like 0.1 + 0.2 ≠ 0.3.
Which One Should You Choose?
Need exact cents or DSP audio? Pick Fixed. Need planetary physics or ML gradients? Float is faster and good enough. Modern CPUs handle float in nanoseconds; fixed saves battery on tiny microcontrollers.
Why does 0.1 + 0.2 show 0.30000000000000004 in code?
Floating Point can’t store 0.1 exactly in binary, so tiny rounding errors accumulate and surface during arithmetic.
Can I mix Fixed and Floating in the same project?
Yes—store currency as fixed 64-bit integers (cents) and graphics positions as floats; just convert carefully at boundaries.