liveBook · Manning

Q-format

As explained in Quantization and Fast Inference

Q-format notation specifies how a fixed-point number's bits are allocated between its integer and fractional components.

Q-format describes fixed-point values by allocating bits to integer and fractional parts. In signed Q3.4, four fractional bits set the scale to 1/16: encode a real value by multiplying by 16, then decode by multiplying the stored integer by 1/16. section 2.1

Equation 2.1
RealValue=Integer × S

Use the equation to relate a stored integer to its represented real value. section 2.1

Encoding and decoding

In Q3.4, 1.5 becomes 24 because 1.5 × 16 = 24. The 8-bit pattern 1111 1111 represents −1 as a signed integer, or −0.0625 after scaling. section 2.1

With a fixed bit width, allocating more bits to the fractional part improves resolution but narrows the representable range; allocating more to the integer part does the reverse. section 2.1

How Quantization and Fast Inference covers it

How deep it goes
Works through scaling, signed two's-complement decoding, and range–precision tradeoffs with numerical examples.
Examples
Uses Q3.4 encodings for 1.5 and 1111 1111, plus a fixed-width range–precision comparison.
What you can do after
Apply Q-format by converting between real values and scaled integers.
How it connects
Connects fixed-point representation to two's complement and quantization.

Also explained in

Compare how 2 books explain q-format →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Quantization and Fast Inference. The section links point to the parts of the book it draws on.