Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am stumped on a simple problem. Let's say I have two 4 bit numbers in Q0.3 format. One sign bit and three fractional bits. So I can represent $-1$ through to $0.875$.

Let's now say I wish to do this calculation: $-0.25 \times 0.875$. Which is:

$$ \frac{-2}{2^3} \times \frac{7}{2^3} $$

Which means I am multiplying $1110$ ($-2$) by $0111$ ($7$). Of course the answer is $-0.21875$ or $-0.25$ using the closest Q0.3 number.

Let's do the working.

$$ 1110 \times 0111 = 01100010 $$

which when viewed as a Q0.6 number is $1.100010$, which is $-0.46875$ by my books. Why is this incorrect? I expect an answer of $1.110010$ ($-0.21875$).

What have I done wrong?

share|improve this question
up vote 8 down vote accepted

When multiplying two's complement numbers, you have to perform sign extensions to the operands to meet the number of digits your multiplication will yield, i.e., in your case $4 + 4 = 8$ digits.

$$ 11111110_2 \times 00000111_2 = 11110010_2 $$

As there are $2 * 3$ fractional bits, the result is $1.110010_2 = \frac{-14}{2^6} = -0.21875$. Normalizing this number to $3$ fractional bits in Q0.3 format yields $1.110_2 = -0.25$.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.