Assume 161 and 214 are signed 8bit decimal integers stored i
Assume 161 and 214 are signed 8-bit decimal integers stored in two’s complement format. Calculate 161 – 214 using saturating arithmetic. The result should be written in decimal. Show your work
Solution
161
2|161 Remainders
2|80 1
2|40 0
2|20 0
2|10 0
2|5 0
2|2 1
2|1 0
|0 1
taking remainders in reverse order
(161)10 = (10100001)2
214
2|214 Remainders
2|107 0
2|53 1
2|26 1
2|13 0
2|6 1
2|3 0
2|1 1
|0 1
(214)10 = (11010110)2
-214 = 2\'s complement of 214
1s complement of 214 = 00101001
2\'s complement of 214 = +1
-214= 00101010
161-214 = 161 +(-214)
10100001
+ 00101010
= 11001011
now leftmost bit is 1 so the number is negative , so convert it into 2\'s complement
11001011
00110100 1s complement
+1 2\'s complement
( 00110101)2 =(53)10 and sign is negative
so result = -53
161-214 =-53


