Fixed point vs floating point: two ways to store fractions in binary
Computers store fractions in two main ways. In fixed point the binary point sits at an agreed position: an 8-bit number with 4 integer bits and 4 fraction bits counts in steps of 1/16, from 0 to 15.9375 if unsigned, and is added and subtracted with exactly the same hardware as integers. In floating point the number is stored like scientific notation in binary: a sign, an exponent and a fraction (mantissa), as defined by IEEE 754, so the point floats to wherever the value needs it. A 32-bit IEEE 754 float uses 1 sign bit, 8 exponent bits and 23 fraction bits; a 64-bit double uses 1, 11 and 52; a 16-bit half uses 1, 5 and 10. Fixed point gives the same step size everywhere and cheap hardware; floating point gives an enormous range with roughly constant relative precision.
What each one is good at
Fixed point is fast, predictable and cheap: integer adders and multipliers do the work, every value has the same absolute resolution, and results are exact as long as they stay in range, which suits signal processing, audio, graphics on small chips, money in cents, and microcontrollers without a floating-point unit. Floating point covers numbers from tiny to astronomically large in the same format, with about 7 significant decimal digits for a float and about 16 for a double, which is why scientific computing and most general-purpose software use it. Neither can store 0.1 exactly in binary; the difference is how the rounding error behaves.
Try both in digiwleea
See any number's IEEE 754 bits, sign, exponent and fraction, in the floating point converter for 16, 32 and 64-bit formats. The fixed-point and floating-point lessons explain both formats step by step, and in the course you build the integer adder that fixed-point arithmetic runs on, from transistors up.
Side by side
| Fixed point | Floating point (IEEE 754) | |
|---|---|---|
| Stored as | An integer with an implied binary point | Sign, exponent and fraction |
| Range | Small, set by the bit split | Very wide |
| Precision | Same absolute step everywhere | About the same relative precision everywhere |
| Hardware | Integer adders and multipliers | A floating-point unit, or software |
| Example (8 bits, 4.4) | 0110.1000 = 6.5 | 6.5 as float32 = 0 10000001 10100000000000000000000 |
No sign-up is needed to start: open the lab and place your first transistor, or read the free theory course. The account (and the AI tutor) are optional.
More comparisons: Digital logic concepts compared
See for yourself: build a logic gate from transistors in the simulator, then follow the path from sand to an 8-bit CPU.
Open the digiwleea lab →Frequently asked
What is the difference between fixed point and floating point?
Fixed point stores numbers with the binary point at a fixed position, so every value has the same resolution. Floating point stores a sign, an exponent and a fraction, so the point can move and the format covers a much wider range.
Which is more accurate, fixed or floating point?
It depends on the range. Within a small known range, fixed point can be exact to its step size. Over a wide range, floating point keeps about the same relative precision everywhere, while fixed point would lose small values or overflow on large ones.
How many bits are in a float's exponent and mantissa?
An IEEE 754 single-precision float has 1 sign bit, 8 exponent bits and 23 fraction bits. A double has 1, 11 and 52. A half-precision float has 1, 5 and 10.
Why is fixed point used in microcontrollers?
Because it runs on the integer hardware every processor already has, which is faster and smaller than a floating-point unit that many small chips lack.