Q formats

You will learn

How to read and write a Qm.n fixed-point word: its range, its step and the bits around the binary point.

Qm.n has m integer bits counting the sign and n fraction bits; the word stands for its integer value times 2^-n. Q1.15 is a 16-bit word from -1 to 0.99997 in steps of 2^-15. 0.7 has no exact Q1.15 word: the nearest is 22938, worth 0.70001. The top bit weighs minus its place, which is all two's complement is. The spec fixed_point.t27 computes the range, the step, every bit and the word a value rounds to.

Open the interactive lesson →