324_Book

# Encodes the exponent in the single precision oating

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: complement machine using arithmetic right shifts, the C expression (x&lt;0 ? (x + (1&lt;&lt;k)1) : x) &gt;&gt; k is equivalent to x/pwr2k, where pwr2k equals ¾k . For example, to divide by ¾, we ﬁrst add bias ¾ ½ ½ giving bit pattern ½½¼¼ . Right shifting this by one arithmetically gives bit pattern ½½½¼ , which is the two’s complement representation of ¾. Practice Problem 2.22: In the following code, we have omitted the deﬁnitions of constants M and N: #define M /* Mystery number 1 */ #define N /* Mystery number 2 */ int arith(int x, int y) { int result = 0; result = x*M + y/N; /* M and N are mystery numbers. */ return result; } Ü ½ Ü ½ Ü ½ Ü ¾ Ü which is the sign extension from Û bits to Û bits of Ü ½ Ü ¾ Ü . Thus, this shifted bit vector is the two’s complement representation of Ü Ý . For Ü ¼, our analysis shows that this shifted result is the desired value. For Ü ¼ and Ý ¼, however, the result of integer division should be Ü Ý , where for any real number , is deﬁned to be the unique...
View Full Document

## This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online