In: Computer Science
Add 111 0011 to 100 1100 and show the V and C bits (seven bits)
V = 1 C = 1 because overflow (V) was there and carry (C) was there Explanation: ------------- Adding 1110011 and 1001100 in binary 1110011 1001100 ------------ (1)0111111 ------------ Sum produces a carry of 1. We can ignore that carry. So, sum of these numbers in binary is 0111111 Verification --------------- first = 1110011 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 1110011 is flipped to 0001100 II. Add 1 to above result 0001100 + 1 = 0001101 III. Now convert this result to decimal value Converting 1101 to decimal 1101 => 1x2^3+1x2^2+0x2^1+1x2^0 => 1x8+1x4+0x2+1x1 => 8+4+0+1 => 13 Answer: -13 second = 1001100 since left most bit is 1, this number is negative number. so, follow these steps below to convert this into a decimal value. I. first flip all the bits. Flip all 0's to 1 and all 1's to 0. 1001100 is flipped to 0110011 II. Add 1 to above result 0110011 + 1 = 0110100 III. Now convert this result to decimal value Converting 110100 to decimal 110100 => 1x2^5+1x2^4+0x2^3+1x2^2+0x2^1+0x2^0 => 1x32+1x16+0x8+1x4+0x2+0x1 => 32+16+0+4+0+0 => 52 Answer: -52 sum = 0111111 since left most bit is 0, this number is positive so, we can directly convert this into a decimal value Converting 111111 to decimal 111111 => 1x2^5+1x2^4+1x2^3+1x2^2+1x2^1+1x2^0 => 1x32+1x16+1x8+1x4+1x2+1x1 => 32+16+8+4+2+1 => 63 Answer: 63 -13+-52 must be -65 This is not correct since we can verify that -13+-52 not equals 63 So, there was an overflow.