Forum Discussion
Altera_Forum
Honored Contributor
14 years agoMultiplication Rounding
Hey guys, I am multiplying two 32 bit numbers using LPM_MULT. Each number is in Q16.16 fixed point format. The product is a 64 bit Q32.32 number. I then shift the product to the ri...
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- Now, this is Q4.4. I need Q2.2. You can't represent 14 with two bits. So there will be some wrap around. That is why I need rounding. Essentially, the desired product would be some smaller wrap around number, and a fractional portion of two bits. --- Quote End --- It's unclear, what you want to achieve. As a first point, the term rounding isn't commonly used for the handling of overflow problems. Basically there are two options: - omit/cut the high bits, which causes wrap around, in case of signed numbers often resulting in a wrong sign - apply saturation logic, limiting the output to the highest respectively lowest value that can be represented in the number system. This technique is mostly applied in digital signal processing