🔢

Fixed Point (Q-Format) Converter

Convert between floating-point and signed Qm.n fixed-point representation.

Input
Results
Format—
Valid Range—
Scale Factor (2^n)—
Q Integer—
Hex—
Binary—
Actual value—
Quantization Error—
💡 Usage & Formula

Q-Format Fixed-Point represents fractional numbers using pure integers, which is vital for high-speed DSP operations on MCUs without a hardware FPU.

Formulas:

  • Scale Factor: 2^n
  • Fixed-Point Value: Round(Float * 2^n)
  • Float equivalent: Fixed_Value / 2^n

Usage: Input the number of integer bits (m) and fractional bits (n), then enter either a floating-point value or a raw integer to convert bidirectionally.

When you need it: Doing DSP, PID or sensor-scaling math on an MCU without an FPU — representing fractions as scaled integers (Q15, Q1.15) so filters and control loops run fast in integer arithmetic.

Worked example: In Q15 (15 fractional bits) 0.75 → 0.75 × 32768 = 24576 (0x6000). The resolution is 1 / 32768 ≈ 3.05e-5 and the representable range of Q1.15 is [−1.0, +0.99997].

Tips & gotchas:

  • Multiplying two Qn values gives a Q2n result — shift right by n to renormalise back to Qn.
  • Guard against overflow: accumulate in a wider type (e.g. 32-bit for Q15 products) or use saturating math.
  • Q15 cannot represent exactly +1.0; scale your coefficients so they stay below full-scale.
  • Round before truncating (add half an LSB) to avoid a consistent downward bias in long sums.