This preview shows page 1. Sign up to view the full content.
Unformatted text preview: epresented by the low-order bits Ü ½ Ü¼ . By a similar analysis as the unsigned case, we have Ü ¾ Ü¼ · Ü¼¼ , and ¼ Ü¼¼ ¾ , giving Ü¼ Ü ¾ . Furthermore, observe that shifting bit vector ÜÛ ½ ÜÛ ¾ Ü¼ right arithmetically by yields a bit vector Ü ½ Ü ¾ Ü ½ Ü ¾ Ü Ü¼ by yields bit vector ¼ . That is, integer division should round negative results upward integer ¼ such that ¼ ½ toward zero. For example the C expression -5/2 yields -2. Thus, right shifting a negative number by is not equivalent to dividing it by ¾ when rounding occurs. For example, the four-bit representation of is ½¼½½ . If we shift it right by one arithmetically we get ½½¼½ , which is the two’s complement representation of ¿.
We can correct for this improper rounding by “biasing” the value before shifting. This technique exploits the property that Ü Ý ´Ü · Ý ½µ Ý for integers Ü and Ý such that Ý ¼. Thus, for Ü ¼, if we ﬁrst add ¾ ½ to Ü before right shifting, we will get a correctly rounded result. This analysis shows that for a two’s...
View Full Document
- Spring '10
- The American