Forum Discussion
Altera_Forum
Honored Contributor
14 years agoFixed Point Rounding
Hey guys,
I have one more question about fixed point rounding. If you multiply two numbers and have to perform rounding, how would you do that with fixed point? I'm currently rounding a 32 bit product down to 16 bits by truncating the first 15 bits, thus performing a division by 2^15. But, if you have four bits representing the fractional part, how do you perform the rounding?11 Replies
- Altera_Forum
Honored Contributor
There are few rounding algorithms:
direct truncation (same as floor of matlab) basic (same as nearest of matlab) dc unbiassed (convergent of matlab) round to nearest integer (round of matlab) I normally go for basic: very simple: to round 32 bits to 16 bits: add msb of truncated section (bit index 15) to the 16 bits(b31:b16). thats all but be careful about saturation.