Q Format Fixed-Point Converter
Convert between floating point and Qm.n fixed point, showing two's complement binary, hex, quantisation error and the representable range.
Common layouts
Conversion Q1.15
16 bit- Fixed-point integer
- 23167
- Binary
- 0101101001111111
- Hex
- 5A7F
- Range
- -1 ~ 0.999969482421875
- Resolution
- 0.000030517578125
- Quantisation error
- 7.324e-7
- Float value
- 0.707000732421875
In Qm.n the m includes the sign bit: Q1.15 is 16 bits (1 sign + 15 fraction) covering -1 to 0.999969. Some vendors count the sign separately, which shifts everything by one bit — check your datasheet before use.
Quantisation error is quantised minus original and never exceeds half a resolution. The only way to shrink it is more fraction bits, which costs integer range.
Fixed point is much faster than float on MCUs and DSPs: adds are integer adds and a multiply is followed by a right shift of n bits. The price is watching for overflow yourself.
Comments
No comments yet — be the first to say something