Question

add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also...

add the following numbers using 16-bit 2's complement.
show all the steps and calculations.
Please also show steps to verify that the answer is correct.

9288 and -7372

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Number: 9288
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 9288 successively by 2 until the quotient is 0
   > 9288/2 = 4644, remainder is 0
   > 4644/2 = 2322, remainder is 0
   > 2322/2 = 1161, remainder is 0
   > 1161/2 = 580, remainder is 1
   > 580/2 = 290, remainder is 0
   > 290/2 = 145, remainder is 0
   > 145/2 = 72, remainder is 1
   > 72/2 = 36, remainder is 0
   > 36/2 = 18, remainder is 0
   > 18/2 = 9, remainder is 0
   > 9/2 = 4, remainder is 1
   > 4/2 = 2, remainder is 0
   > 2/2 = 1, remainder is 0
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 10010001001000
So, 9288 of decimal is 10010001001000 in binary
Adding 2 zeros on left hand side of this number to make this of length 16
so, 9288 in 2's complement binary is 0010010001001000

Number: -7372
Let's convert this to two's complement binary
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
Divide 7372 successively by 2 until the quotient is 0
   > 7372/2 = 3686, remainder is 0
   > 3686/2 = 1843, remainder is 0
   > 1843/2 = 921, remainder is 1
   > 921/2 = 460, remainder is 1
   > 460/2 = 230, remainder is 0
   > 230/2 = 115, remainder is 0
   > 115/2 = 57, remainder is 1
   > 57/2 = 28, remainder is 1
   > 28/2 = 14, remainder is 0
   > 14/2 = 7, remainder is 0
   > 7/2 = 3, remainder is 1
   > 3/2 = 1, remainder is 1
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 1110011001100
So, 7372 of decimal is 1110011001100 in binary
Adding 3 zeros on left hand side of this number to make this of length 16
So, 7372 in normal binary is 0001110011001100
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   0001110011001100 is flipped to 1110001100110011
Step 3:. Add 1 to above result
1110001100110011 + 1 = 1110001100110100
so, -7372 in 2's complement binary is 1110001100110100

Adding 0010010001001000 and 1110001100110100 in binary
0010010001001000
1110001100110100
---------------------
(1)0000011101111100
---------------------
Sum produces a carry of 1. We can ignore that carry.
So, sum of these numbers in binary is 0000011101111100

Verification:
---------------
sum = 0000011101111100
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 11101111100
=> 1x2^10+1x2^9+1x2^8+0x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+0x2^1+0x2^0
=> 1x1024+1x512+1x256+0x128+1x64+1x32+1x16+1x8+1x4+0x2+0x1
=> 1024+512+256+0+64+32+16+8+4+0+0
=> 1916
Answer: 1916
This is correct since we can verify that 9288+-7372 = 1916
So, there was no overflow.


Add a comment
Know the answer?
Add Answer to:
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT