Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

HW4 solution

3.8
Sign-magnitude 8-bit: min = -127
Unsigned 18510 = 1011_10012 = Signed −5710
Unsigned 12210 = 0111_10102 = Signed 12210
-71 - 122 = -193 < -127 → overflow

3.11
Unsigned 8-bit: max = 255
15110 + 21410 = 36510 = 1_0110_11012
The result is 255 due to saturation.

3.15
It requires 4 time units to get through an adder.
For 8-bit integers, it requires 7 adders and 7*4 = 28 time units in total.

3.17
0x33 = 5110 = 25 + 24 + 21 + 20
0x33 * 0x55 = (𝟐𝟓 + 𝟐𝟒 + 𝟐𝟏 + 𝟐𝟎 ) * 0x55
= (0x55 << 5) + (0x55 << 4) + (0x55 << 1) + 0x55 = 0x10EF = 𝟒𝟑𝟑𝟓𝟏𝟎

3.19

R = 𝟎𝟎𝟏𝟎𝟎𝟏𝟐, Q = 𝟎𝟎𝟎𝟎𝟏𝟏𝟐
3.22
0x0C000000 = 0000_1100_0000_0000_0000_0000_0000_0000
S = 0 → positive
E = 0001_10002 = 24 → 24-127= -103
F = 000_0000_0000_0000_0000_00002

0x0C000000 = 1.0 * 𝟐−𝟏𝟎𝟑 in IEEE 754 standard format.

3.23
63.2510 = (111111.01)2 = (1.1111101)2 * 25 = (1.1111101)2 * 2132−127
S = 0 → positive
E = 5+127 = 132 = 100001002
F = 11111012
Therefore,
𝟔𝟑. 𝟐𝟓𝟏𝟎 = 𝟎_𝟏𝟎𝟎𝟎𝟎𝟏𝟎𝟎_𝟏𝟏𝟏𝟏𝟏𝟎𝟏𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎 = 0x427D_0000 in IEEE 754 single
precision format.

3.24
63.2510 = (111111.01)2 = (1.1111101)2 * 25 = (1.1111101)2 * 21028−1023
S = 0 → positive
E = 5+1023 = 1028 = 100000001002
F = 11111012
Therefore,
𝟔𝟑. 𝟐𝟓𝟏𝟎 =
𝟎_𝟏𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟏𝟎𝟎_𝟏𝟏𝟏𝟏𝟏𝟎𝟏𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎𝟎 =
0x404F_A000_0000_0000 in IEEE 754 double precision format.

3.27
-1.5625 * 10−1 = −(0.00101)2 * 20 = −(1.01)2* 2−3
S = 1→ Negative
E = -3+15 = 12 = 011002
F = 01000000002
Therefore, -1.5625 * 𝟏𝟎−𝟏 = 1_01100_0100000000 in this 16-bit floating point format.
3.31 (You need to show the whole calculation.)
86.25 = 1010110.01 2 = (1.0101100100) 2 * 2−6
-4.875 = −(100.111) 2 = −(1.0011100000) 2 * 22
𝟖𝟔.𝟐𝟓
= −(𝟏. 𝟎𝟎𝟎𝟏𝟏𝟎𝟏𝟏𝟎𝟎_𝟎𝟏𝟏 ) 𝟐 * 𝟐𝟒 (011 → no round)
−𝟒.𝟖𝟕𝟓

= -17.6875
S=1
E = 4+15 = 19 =(10011)2
F = (0001101100)2
(−17.6875) 10 = 1_10011_0001101100 in 16-bit format.
Decimal = 86.25 * -4.875 = -17.69230769
Compare the results : −(𝟏𝟕. 𝟔𝟖𝟕𝟓) 𝟏𝟎 − (−(𝟏𝟕. 𝟔𝟗𝟐𝟑𝟎𝟕𝟔𝟗)𝟏𝟎 ) = 4.807692308 * 𝟏𝟎−𝟑

3.35
3.41796875*10−3 = (0.00000000111)2 = (1.11)2 *2−9
6.34765625*10−3 = (0.00000001101)2 = (1.101)2 *2−8
1.05625*10−2 = (1101001.101)2 = (1.101001101)2 *26
(-9)+(-8) = -17, E = -17 + 14 < 0 → underflow
Therefore, the number cannot be presented.

3.36 (You need to show the whole calculation.)


(1.101)2 *2−8 * (1.101001101)2 *26 = (1.0101011101)2 *2(−8+6+1)
(1.11)2 *2−9 * (1.0101011101)2 *2−1 = (1.0010110001)2 *2(−9−1+1)
= (1.0010110001)2 *2−9 = (0.0000000010010110001)2 = 2.2907 … *10−3
S=0
E = -9+15 = 6 = (00110)2
F = (0010110001)2
Therefore, we have the number in 16-bit format: 0_00110_0010110001, which is 𝟐. 𝟐𝟗 *𝟏𝟎−𝟑 in
decimal.

3.37
They are not the same, since the result of 3.35 is underflow.

You might also like