Question

In: Computer Science

Add or subtract the following 2’s complement form signed numbers, then convert the entire problem to...

  1. Add or subtract the following 2’s complement form signed numbers, then convert the entire problem to decimal and confirm:
  1. 110110 + 111000
  2. 001100 – 011100

Solutions

Expert Solution

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

Verification
---------------
first = 110110
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.
   110110 is flipped to 001001
II. Add 1 to above result
001001 + 1 = 001010
III. Now convert this result to decimal value
Converting 1010 to decimal
1010
=> 1x2^3+0x2^2+1x2^1+0x2^0
=> 1x8+0x4+1x2+0x1
=> 8+0+2+0
=> 10
Answer: -10

second = 111000
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.
   111000 is flipped to 000111
II. Add 1 to above result
000111 + 1 = 001000
III. Now convert this result to decimal value
Converting 1000 to decimal
1000
=> 1x2^3+0x2^2+0x2^1+0x2^0
=> 1x8+0x4+0x2+0x1
=> 8+0+0+0
=> 8
Answer: -8

sum = 101110
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.
   101110 is flipped to 010001
II. Add 1 to above result
010001 + 1 = 010010
III. Now convert this result to decimal value
Converting 10010 to decimal
10010
=> 1x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 1x16+0x8+0x4+1x2+0x1
=> 16+0+0+2+0
=> 18
Answer: -18
This is correct since we can verify that -10+-8 = -18
So, there was no overflow.

b)
001100-011100 = 001100+(-011100)
let's first convert -011100 to two's complement positive.

convert -011100 to two's complement
Step 1: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   011100 is flipped to 100011
Step 2:. Add 1 to above result
100011 + 1 = 100100
Adding 001100 and 100100 in binary
    001100
    100100
-----------
 (0)110000
-----------
Sum does not produces a carry
So, sum of these numbers in binary is 110000

Verification
---------------
first = 001100
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 1100 to decimal
1100
=> 1x2^3+1x2^2+0x2^1+0x2^0
=> 1x8+1x4+0x2+0x1
=> 8+4+0+0
=> 12
Answer: 12

second = 100100
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.
   100100 is flipped to 011011
II. Add 1 to above result
011011 + 1 = 011100
III. Now convert this result to decimal value
Converting 11100 to decimal
11100
=> 1x2^4+1x2^3+1x2^2+0x2^1+0x2^0
=> 1x16+1x8+1x4+0x2+0x1
=> 16+8+4+0+0
=> 28
Answer: -28

sum = 110000
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.
   110000 is flipped to 001111
II. Add 1 to above result
001111 + 1 = 010000
III. Now convert this result to decimal value
Converting 10000 to decimal
10000
=> 1x2^4+0x2^3+0x2^2+0x2^1+0x2^0
=> 1x16+0x8+0x4+0x2+0x1
=> 16+0+0+0+0
=> 16
Answer: -16
This is correct since we can verify that 12+-28 = -16
So, there was no overflow.

Related Solutions

(a) Convert the decimal numbers, 70 and -26 to binary in the signed 2’s complement system....
(a) Convert the decimal numbers, 70 and -26 to binary in the signed 2’s complement system. Make sure there are enough digits in the results to be able to perform arithmetic operations with these two numbers. (b) Perform in the signed 2’s complement system, (+70) + (-26) (c) Perform in the signed 2’s complement system, (-70) - (-26) (d) Perform in the signed 2’s complement system, (+70) + (+26)
Problem 5: Perform the subtraction on the following pairs of signed numbers using the 2’s complement...
Problem 5: Perform the subtraction on the following pairs of signed numbers using the 2’s complement system. Express the results as signed binary numbers and as decimal values. Please show all work to fully understand. A. 01001 - 11010 B. 10010 - 10011
Convert each of the following 5-digit 6’s complement base 7 numbers to 9-digit 4’s complement base...
Convert each of the following 5-digit 6’s complement base 7 numbers to 9-digit 4’s complement base 4. Be careful, show all your reasoning/arithmetic, and make no unwarranted assumptions! (a) 50135 (b) 11402
Convert decimal +47 and +31 to binary, using the signed-2’s-complement representation and enough digits to accommodate...
Convert decimal +47 and +31 to binary, using the signed-2’s-complement representation and enough digits to accommodate the numbers. Then perform the binary equivalent of (+31)+(-47), (-31)+(+47), and (-31)+(-47). Convert the answers back to decimal and verify that they are correct.
(16%) Convert decimal +47 and +38 to binary, using the signed-2’s-complement representation and enough digits to...
(16%) Convert decimal +47 and +38 to binary, using the signed-2’s-complement representation and enough digits to accommodate the numbers, Then, perform the binary equivalent of (+47)+(-38) and (-47)+(-38) using addition. Convert the answers back to decimal and verify that they are correct.
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030...
Convert the following decimal numbers to 16-bit 2’s complement binary. Display your result in hexadecimal. a.3030 b.404 c.5050 d.-5050 e.-20000 Show work with steps
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -18 to 8-bit sign magnitude, 1's complement and 2's complement.
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
Convert -122 to 8-bit sign magnitude, 1's complement and 2's complement
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT