Q (number format)
The Q notation is a way to specify the parameters of a binary fixed point number format. Specifically, how many bits are allocated for the integer portion, how many for the fractional portion, and whether there is a sign-bit.
For example, in Q notation, Q7.8 means that the signed fixed point numbers in this format have 7 bits for the integer part and 8 bits for the fraction part. One extra bit is implicitly added for signed numbers. Therefore, Q7.8 is a 16-bit word, with the most significant bit representing the two's complement sign bit.
| Q7.8 | Sign bit | 7-bit integer | 8-bit fraction | |||||||||||||
| Bit Value | ||||||||||||||||
There is an ARM variation of the Q notation that explicitly adds the sign bit to the integer part. In ARM Q notation, the above format would be called Q8.8.
A number of other notations have been used for the same purpose.