Question

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

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

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

Number: 99288
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 99288 successively by 2 until the quotient is 0
   > 99288/2 = 49644, remainder is 0
   > 49644/2 = 24822, remainder is 0
   > 24822/2 = 12411, remainder is 0
   > 12411/2 = 6205, remainder is 1
   > 6205/2 = 3102, remainder is 1
   > 3102/2 = 1551, remainder is 0
   > 1551/2 = 775, remainder is 1
   > 775/2 = 387, remainder is 1
   > 387/2 = 193, remainder is 1
   > 193/2 = 96, remainder is 1
   > 96/2 = 48, remainder is 0
   > 48/2 = 24, remainder is 0
   > 24/2 = 12, remainder is 0
   > 12/2 = 6, remainder is 0
   > 6/2 = 3, remainder is 0
   > 3/2 = 1, remainder is 1
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 11000001111011000
So, 99288 of decimal is 11000001111011000 in binary
Adding 15 zeros on left hand side of this number to make this of length 32
so, 99288 in 2's complement binary is 00000000000000011000001111011000

Number: -99772
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 99772 successively by 2 until the quotient is 0
   > 99772/2 = 49886, remainder is 0
   > 49886/2 = 24943, remainder is 0
   > 24943/2 = 12471, remainder is 1
   > 12471/2 = 6235, remainder is 1
   > 6235/2 = 3117, remainder is 1
   > 3117/2 = 1558, remainder is 1
   > 1558/2 = 779, remainder is 0
   > 779/2 = 389, remainder is 1
   > 389/2 = 194, remainder is 1
   > 194/2 = 97, remainder is 0
   > 97/2 = 48, remainder is 1
   > 48/2 = 24, remainder is 0
   > 24/2 = 12, remainder is 0
   > 12/2 = 6, remainder is 0
   > 6/2 = 3, remainder is 0
   > 3/2 = 1, remainder is 1
   > 1/2 = 0, remainder is 1
Read remainders from the bottom to top as 11000010110111100
So, 99772 of decimal is 11000010110111100 in binary
Adding 15 zeros on left hand side of this number to make this of length 32
So, 99772 in normal binary is 00000000000000011000010110111100
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00000000000000011000010110111100 is flipped to 11111111111111100111101001000011
Step 3:. Add 1 to above result
11111111111111100111101001000011 + 1 = 11111111111111100111101001000100
so, -99772 in 2's complement binary is 11111111111111100111101001000100

Adding 00000000000000011000001111011000 and 11111111111111100111101001000100 in binary
00000000000000011000001111011000
11111111111111100111101001000100
-------------------------------------
(0)11111111111111111111111000011100
-------------------------------------
Sum does not produces a carry
So, sum of these numbers in binary is 11111111111111111111111000011100

Verification:
---------------
sum = 11111111111111111111111000011100
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.
   11111111111111111111111000011100 is flipped to 00000000000000000000000111100011
II. Add 1 to above result
00000000000000000000000111100011 + 1 = 00000000000000000000000111100100
III. Now convert this result to decimal value
=> 111100100
=> 1x2^8+1x2^7+1x2^6+1x2^5+0x2^4+0x2^3+1x2^2+0x2^1+0x2^0
=> 1x256+1x128+1x64+1x32+0x16+0x8+1x4+0x2+0x1
=> 256+128+64+32+0+0+4+0+0
=> 484
Answer: -484
This is correct since we can verify that 99288+-99772 = -484
So, there was no overflow.

Add a comment
Answer #2

To add the numbers 99288 and -99772 using 32-bit 2's complement, follow these steps:

Step 1: Convert the numbers to binary representation.

99288 in binary: 0000 0000 0000 0001 0011 0001 1000 1000 -99772 in binary (2's complement of 99772): 1111 1111 1110 1101 1100 1100 1100 0100

Step 2: Add the numbers.

0000 0000 0000 0001 0011 0001 1000 1000

  • 1111 1111 1110 1101 1100 1100 1100 0100


(1) 0000 0000 0000 0000 0000 0001 0100 1100

Step 3: Check for overflow. In 32-bit 2's complement, overflow occurs when the most significant bit (MSB) changes during addition.

In this case, the MSB of both numbers is 0, and the MSB of the result is also 0. Therefore, there is no overflow.

Step 4: Convert the binary result back to decimal.

(1) 0000 0000 0000 0000 0000 0001 0100 1100 The MSB is 0, so this is a positive number.

Result = 0000 0000 0000 0000 0000 0001 0100 1100 in decimal = 132

Step 5: Verify the answer.

99288 + (-99772) = -484

Therefore, the answer obtained through 32-bit 2's complement addition is -484, which matches the verified result.

answered by: Hydra Master
Add a comment
Know the answer?
Add Answer to:
add the following numbers using 32-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
ADVERTISEMENT