Professional Documents
Culture Documents
1. (10 points) Convert the following integers to 8-bit unsigned binary representation.
a) 43 2|________43__ ……….1
2|_______21__ ………1
2|______10__ ………0
2|_____5___ ………1 -> 00101011
2|____2___ ……….0
2|___1___ ……….1
0
or: 43 = 32 + 11 = 32 + 8 + 2+1= 0x27+0x26+1x25+0x24+1x23+0x22+1x21+1x20
Thus we have 00101011
2. (15 points) Convert the following integers to 8-bit signed (two’s-complement) binary.
a)
For positive number we just convert directly
37 = 0 + 0 + 32 + 0 + 0 + 4 + 0 + 1 -> 00100101
b) use the result from the last problem, first take the
00100101
1’s complement 11011010
+__________1
11011011 -> 11011011
5. (15 points) What is the range of decimal numbers that can be represented in:
a) 8–bit two’s–complement form? -27 to 27-1 (-128 to 127 )
b) 16–bit two’s–complement form? -215 to 215 (-32768 to 32767)
c) 8-bit unsigned form? 0 to 28-1 (0 to 255)
6. (15 points) Show the IEEE-754 single precision representation of the following real
numbers.
Use eight hexadecimal digits for your results.
a) 15.625
1510 = 11112
0.62510 =1/2 + 1/8 = 0.1012
thus 15.62510 = 1111.1012 = 1.111101 x 23
s = 0. p=3. p+127 = 130 = 128 + 2 = 1000000102. m=111101
-> 0 1000 0010 1111 0100 000 ….. = 0100 0001 0111 1010 …. = 0x417A0000
b) – 49.25
49 = 32 + 16 + 1 = 1100012
0.25 = ¼ = 0.012
49.2510 = 110001.012 = 1.1000101 x 25
P=5. P+127 = 128+4 = 100001002
S=1. M=1000101
IEEE-754 Single precision: 1 10000100 1000101 …….
Regroup =1100 0010 0100 0101 0000 … 00 = 0xC2450000
7. (10 points) Assuming 8-bit 2’s complement representation for the integers +70 and +
80, consider the following:
+70 = 010001102
+80 = 010100002
Add them together and the result is 100101102. Is this correct? Why or why not?
8. (10 points) The following two hexadecimal numbers represent real numbers
formatted according to the IEEE-754 single precision standard. Translate these to
decimal numbers.
a) C1541000
1100 0001 0101 0100 0001 000000000000 = 1 10000010 1010100000100..00
s=1
100000102 = 130 - 127, p = 3
m = 10101000001
binary = 1.10101000001 x 23 = 1101.01000001
approx. – 13.25
b) BAD2000
1011 1010 1101 0010 000000000000 = 1 01110101 101001 00000
s=1
011101012 = 117 P+127=127 -> P= -10
m = 101001
Binary = -1.101001 x 2-10 -> -1.6406265 x 2-10
≈ –1.6406265 x 10-10x0.30103 ≈ -1.6406265 x 10-3.0103
≈ -1.6022 x 10-3