Fixed-Point Math Calculator
Pick Q formats for each input and the output. See the raw integers, the stored real value, and the quantization error, live.
Fixed-Point Math Calculator
Pick a Q format for each input. For multiply and divide, pick the shift count N - the output Q is computed from qA, qB, and N. Add and subtract require both operands in the same Q.
Raw int: 20971520 = 20971520 / 2^24
Stored as: 1.250000000
Quant error: 0.000000%
Q24: range +/-128, LSB 5.96e-8
Raw int: 10923 = 10923 / 2^15
Stored as: 0.3333435059
Quant error: 0.0032%
Q15: range +/-65536, LSB 0.0000305
_IQ15mpy(_IQ24(1.25), _IQ15(0.333333)); // result Q24
Ideal (real): 0.416666250000
Raw int (Q24): 6990720
Total error vs real math: 0.0032%
Uses signed-32-bit storage. Values above a format’s range clamp to Int32 bounds. Multiplication uses BigInt internally for full 64-bit precision before the right-shift back to the output Q.
For a walkthrough of what Q formats are, how addition/multiplication/division actually work at the bit level, and why mixing IQNmpy with IQNdiv wisely matters, read the fixed-point math guide.