Question

2) Perform the following Mathematical operations Using 2s complement, Indicate where overflow occurs, (You must convert to s

0 0
Add a comment Improve this question Transcribed image text
Answer #1
a)
Number: 11
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 11 successively by 2 until the quotient 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 1011
So, 11 of decimal is 1011 in binary
Adding 4 zeros on left hand side of this number to make this of length 8
so, 11 in 2's complement binary is 00001011

Number: -6
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 6 successively by 2 until the quotient 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 110
So, 6 of decimal is 110 in binary
Adding 5 zeros on left hand side of this number to make this of length 8
So, 6 in normal binary is 00000110
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00000110 is flipped to 11111001
Step 3:. Add 1 to above result
11111001 + 1 = 11111010
so, -6 in 2's complement binary is 11111010

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

Verification:
---------------
sum = 00000101
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 101
=> 1x2^2+0x2^1+1x2^0
=> 1x4+0x2+1x1
=> 4+0+1
=> 5
Answer: 5
This is correct since we can verify that 11+-6 = 5
So, there was no overflow.

b)
Number: -4
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 4 successively by 2 until the quotient is 0
   > 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 100
So, 4 of decimal is 100 in binary
Adding 5 zeros on left hand side of this number to make this of length 8
So, 4 in normal binary is 00000100
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00000100 is flipped to 11111011
Step 3:. Add 1 to above result
11111011 + 1 = 11111100
so, -4 in 2's complement binary is 11111100

Number: 11
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 11 successively by 2 until the quotient 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 1011
So, 11 of decimal is 1011 in binary
Adding 4 zeros on left hand side of this number to make this of length 8
so, 11 in 2's complement binary is 00001011

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

Verification:
---------------
sum = 00000111
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 111
=> 1x2^2+1x2^1+1x2^0
=> 1x4+1x2+1x1
=> 4+2+1
=> 7
Answer: 7
This is correct since we can verify that -4+11 = 7
So, there was no overflow.

c)
Number: -4
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 4 successively by 2 until the quotient is 0
   > 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 100
So, 4 of decimal is 100 in binary
Adding 5 zeros on left hand side of this number to make this of length 8
So, 4 in normal binary is 00000100
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00000100 is flipped to 11111011
Step 3:. Add 1 to above result
11111011 + 1 = 11111100
so, -4 in 2's complement binary is 11111100

Number: -11
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 11 successively by 2 until the quotient 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 1011
So, 11 of decimal is 1011 in binary
Adding 4 zeros on left hand side of this number to make this of length 8
So, 11 in normal binary is 00001011
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00001011 is flipped to 11110100
Step 3:. Add 1 to above result
11110100 + 1 = 11110101
so, -11 in 2's complement binary is 11110101

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

Verification:
---------------
sum = 11110001
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.
   11110001 is flipped to 00001110
II. Add 1 to above result
00001110 + 1 = 00001111
III. Now convert this result to decimal value
=> 1111
=> 1x2^3+1x2^2+1x2^1+1x2^0
=> 1x8+1x4+1x2+1x1
=> 8+4+2+1
=> 15
Answer: -15
This is correct since we can verify that -4+-11 = -15
So, there was no overflow.

d)
Number: 11
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 11 successively by 2 until the quotient 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 1011
So, 11 of decimal is 1011 in binary
Adding 4 zeros on left hand side of this number to make this of length 8
so, 11 in 2's complement binary is 00001011

Number: 4
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 4 successively by 2 until the quotient is 0
   > 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 100
So, 4 of decimal is 100 in binary
Adding 5 zeros on left hand side of this number to make this of length 8
so, 4 in 2's complement binary is 00000100

Adding 00001011 and 00000100 in binary
    00001011
    00000100
-------------
 (0)00001111
-------------
Sum does not produces a carry
So, sum of these numbers in binary is 00001111

Verification:
---------------
sum = 00001111
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
=> 1111
=> 1x2^3+1x2^2+1x2^1+1x2^0
=> 1x8+1x4+1x2+1x1
=> 8+4+2+1
=> 15
Answer: 15
This is correct since we can verify that 11+4 = 15
So, there was no overflow.

e)
Number: 6
Let's convert this to two's complement binary
Since this is a positive number. we can directly convert this into binary
Divide 6 successively by 2 until the quotient 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 110
So, 6 of decimal is 110 in binary
Adding 5 zeros on left hand side of this number to make this of length 8
so, 6 in 2's complement binary is 00000110

Number: -11
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 11 successively by 2 until the quotient 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 1011
So, 11 of decimal is 1011 in binary
Adding 4 zeros on left hand side of this number to make this of length 8
So, 11 in normal binary is 00001011
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   00001011 is flipped to 11110100
Step 3:. Add 1 to above result
11110100 + 1 = 11110101
so, -11 in 2's complement binary is 11110101

Adding 00000110 and 11110101 in binary
    00000110
    11110101
-------------
 (0)11111011
-------------
Sum does not produces a carry
So, sum of these numbers in binary is 11111011

Verification:
---------------
sum = 11111011
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.
   11111011 is flipped to 00000100
II. Add 1 to above result
00000100 + 1 = 00000101
III. Now convert this result to decimal value
=> 101
=> 1x2^2+0x2^1+1x2^0
=> 1x4+0x2+1x1
=> 4+0+1
=> 5
Answer: -5
This is correct since we can verify that 6+-11 = -5
So, there was no overflow.
Add a comment
Know the answer?
Add Answer to:
2) Perform the following Mathematical operations Using 2's complement, Indicate where overflow occurs, (You must convert...
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