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)
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.
Digital arithmetic: a) Convert +35 to 2-complement b) Convert -35 to 2-complement c) Convert 2-complement from...
Digital arithmetic: a) Convert +35 to 2-complement b) Convert -35 to 2-complement c) Convert 2-complement from 1101 1101 to decimal d) Add 35 - 35 in binary
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7...
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7 5 -3
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7...
Complete the matrix below (use 4 bits) Signed Integer Signed Magnitude 1’s Complement 2’s Complement Excess-7 5 -3
All decimal numbers must be converted to signed two’s complement form before working. Use the least...
All decimal numbers must be converted to signed two’s complement form before working. Use the least number of digits necessary (only using one sign bit) to represent the largest number in a given problem. The smaller number must be represented with the same number of bits. If overflow occurs, indicate that with a note. Show step by step subtraction. 13 - 8 6 - 19 21 - 14
All decimal numbers must be converted to signed two’s complement form before working. Use the least...
All decimal numbers must be converted to signed two’s complement form before working. Use the least number of digits necessary (only using one sign bit) to represent the largest number in a given problem. The smaller number must be represented with the same number of bits. If overflow occurs, indicate that with a note. Show step by step addition. 15 + 6 14 + 18 31 + 5
Part 2: Signed values: Convert each as indicated. 8. Decimal to Hexadecimal (1 byte, one's complement)...
Part 2: Signed values: Convert each as indicated. 8. Decimal to Hexadecimal (1 byte, one's complement)      a. -18      b. -41
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers,...
7 – For the following operations: • write the operands as 4-bit 2's complement binary numbers, • perform the operation shown, • show all work in binary operating on 4-bit numbers, and • identify overflow if necessary. a) 4 + 2 b) 4 – 2 c) 2 – 4 d) 4 + 4
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT