Fixed-Point (Qm.n) Converter
Convert between floating point and signed Qm.n fixed-point: hex and binary encodings, representable range, resolution, and the exact quantization error for your value.
Results
- Format
- Q4.12 (signed, 16 bits total)
- Range
- [-8, 7.99976]
- Resolution (LSB)
- 2^-12 = 0.000244141
- Input
- 3.14159
- Stored integer
- 12868
- Hex
- 0x3244
- Binary
- 0011001001000100
- Actual value
- 3.1416015625
- Quantization error
- 8.91e-06
Notes
- Naming varies: some vendors write Q4.12 for 16 bits (sign inside the 4), others add a separate sign bit. Here m includes the sign.
- Multiplying Qa.b x Qc.d gives Q(a+c).(b+d) - plan the truncation and rounding stage before you run out of bits.
About this tool
FPGAs do floating point reluctantly and fixed point natively: a Qm.n number is just an integer with an implied binary point, so adds and multiplies use the plain DSP blocks. The price is that you manage range and precision. This converter shows exactly what a value becomes in your chosen format — hex, binary, the actual stored value and the quantization error — plus the format's range and resolution, so you can pick m and n with evidence instead of superstition. Note the convention here: m includes the sign bit; some datasheets count it separately.