p14m

Fixed-Point Representation

Representing fractional numbers without a floating-point unit.

Problem

How do you represent numbers like 3.75 in hardware without a floating-point unit?

How it works

Fixed-point uses a regular integer with an implied binary point at a fixed position. The hardware does integer arithmetic; the programmer tracks where the point is.

Q notation: Qm.f means m integer bits and f fractional bits. In Q4.4 (8 bits total), the value 3.75 is stored as 0011.1100 = 60 (the integer 60 represents 60/24 = 3.75).

Arithmetic: Addition and subtraction work directly if both operands use the same Q format. Multiplication of Qm.f × Qm.f produces a Q(2m).(2f) result: you shift right by f to get back to Qm.f.

Resolution: with f fractional bits, the smallest representable step is 2−f. Q8.8 has resolution 1/256 ≈ 0.0039. More fractional bits = finer resolution but smaller integer range.
Key insightFixed-point is just integer arithmetic with a bookkeeping convention. The hardware is identical to an integer ALU: no FPU needed.