Forum Discussion
Altera_Forum
Honored Contributor
17 years agoHi,
If you mean how to round up to nearest integer value then: With 2's complement of any computation result we can do rounding by looking at the remainder's MSB. If this MSB bit is 1 then add 1 to quotient else leave the quotient unchanged. This applies to both positive and negative numbers. Be careful about overflowing at this addition of 1 If rounding is not enough then you have to increase the bit resolution. edit: I am assuming your remainder is not signed which is the case in any truncation of signed values so check the format of your remainder.