Question

add -2833 and -238993 using 32-bit 2's complement and show all the steps and also verify...

add -2833 and -238993 using 32-bit 2's complement and show all the steps and also verify that the result is true.

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

Number: -2833
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 2833 successively by 2 until the quotient is 0
   > 2833/2 = 1416, remainder is 1
   > 1416/2 = 708, remainder is 0
   > 708/2 = 354, remainder is 0
   > 354/2 = 177, remainder is 0
   > 177/2 = 88, remainder is 1
   > 88/2 = 44, remainder is 0
   > 44/2 = 22, remainder is 0
   > 22/2 = 11, remainder is 0
   > 11/2 = 5, remainder is 1
   > 5/2 = 2, remainder is 1
   > 2/2 = 1, remainder is 0
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 101100010001
So, 2833 of decimal is 101100010001 in binary
Adding 20 zeros on left hand side of this number to make this of length 32
So, 2833 in normal binary is 00000000000000000000101100010001
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00000000000000000000101100010001 is flipped to 11111111111111111111010011101110
Step 3:. Add 1 to above result
11111111111111111111010011101110 + 1 = 11111111111111111111010011101111
so, -2833 in 2's complement binary is 11111111111111111111010011101111

Number: -238993
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 238993 successively by 2 until the quotient is 0
   > 238993/2 = 119496, remainder is 1
   > 119496/2 = 59748, remainder is 0
   > 59748/2 = 29874, remainder is 0
   > 29874/2 = 14937, remainder is 0
   > 14937/2 = 7468, remainder is 1
   > 7468/2 = 3734, remainder is 0
   > 3734/2 = 1867, remainder is 0
   > 1867/2 = 933, remainder is 1
   > 933/2 = 466, remainder is 1
   > 466/2 = 233, remainder is 0
   > 233/2 = 116, remainder is 1
   > 116/2 = 58, remainder is 0
   > 58/2 = 29, remainder is 0
   > 29/2 = 14, remainder is 1
   > 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 111010010110010001
So, 238993 of decimal is 111010010110010001 in binary
Adding 14 zeros on left hand side of this number to make this of length 32
So, 238993 in normal binary is 00000000000000111010010110010001
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00000000000000111010010110010001 is flipped to 11111111111111000101101001101110
Step 3:. Add 1 to above result
11111111111111000101101001101110 + 1 = 11111111111111000101101001101111
so, -238993 in 2's complement binary is 11111111111111000101101001101111

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

Verification:
---------------
sum = 11111111111111000100111101011110
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.
   11111111111111000100111101011110 is flipped to 00000000000000111011000010100001
II. Add 1 to above result
00000000000000111011000010100001 + 1 = 00000000000000111011000010100010
III. Now convert this result to decimal value
=> 111011000010100010
=> 1x2^17+1x2^16+1x2^15+0x2^14+1x2^13+1x2^12+0x2^11+0x2^10+0x2^9+0x2^8+1x2^7+0x2^6+1x2^5+0x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 1x131072+1x65536+1x32768+0x16384+1x8192+1x4096+0x2048+0x1024+0x512+0x256+1x128+0x64+1x32+0x16+0x8+0x4+1x2+0x1
=> 131072+65536+32768+0+8192+4096+0+0+0+0+128+0+32+0+0+0+2+0
=> 241826
Answer: -241826
This is correct since we can verify that -2833+-238993 = -241826
So, there was no overflow.

Add a comment
Know the answer?
Add Answer to:
add -2833 and -238993 using 32-bit 2's complement and show all the steps and also verify...
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
ADVERTISEMENT