Question

In: Computer Science

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

Solutions

Expert Solution

1)
Number: 15
Let's convert this to two's complement binary
15
Since this is a positive number. we can directly convert this into binary
Divide 15 successively by 2 until the quotient is 0
   > 15/2 = 7, remainder is 1
   > 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 1111
So, 15 of decimal is 1111 in binary
so, 15 in 2's complement binary is 01111

Number: 6
Let's convert this to two's complement binary
6
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
so, 6 in 2's complement binary is 00110

Adding 01111 and 00110 in binary
    01111
    00110
----------
 (0)10101
----------
Sum does not produces a carry
So, sum of these numbers in binary is 10101

Verification:
---------------
sum = 10101
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.
   10101 is flipped to 01010
II. Add 1 to above result
01010 + 1 = 01011
III. Now convert this result to decimal value
Converting 1011 to decimal
1011
=> 1x2^3+0x2^2+1x2^1+1x2^0
=> 1x8+0x4+1x2+1x1
=> 8+0+2+1
=> 11
Answer: -11
15+6 must be 21
This is not correct since we can verify that 15+6 not equals -11
So, there was an overflow.

2)
Number: 14
Let's convert this to two's complement binary
14
Since this is a positive number. we can directly convert this into binary
Divide 14 successively by 2 until the quotient is 0
   > 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 1110
So, 14 of decimal is 1110 in binary
so, 14 in 2's complement binary is 001110

Number: 18
Let's convert this to two's complement binary
18
Since this is a positive number. we can directly convert this into binary
Divide 18 successively by 2 until the quotient is 0
   > 18/2 = 9, remainder is 0
   > 9/2 = 4, remainder is 1
   > 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 10010
So, 18 of decimal is 10010 in binary
so, 18 in 2's complement binary is 010010

Adding 001110 and 010010 in binary
    001110
    010010
-----------
 (0)100000
-----------
Sum does not produces a carry
So, sum of these numbers in binary is 100000

Verification:
---------------
sum = 100000
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.
   100000 is flipped to 011111
II. Add 1 to above result
011111 + 1 = 100000
III. Now convert this result to decimal value
Converting 100000 to decimal
100000
=> 1x2^5+0x2^4+0x2^3+0x2^2+0x2^1+0x2^0
=> 1x32+0x16+0x8+0x4+0x2+0x1
=> 32+0+0+0+0+0
=> 32
Answer: -32
14+18 must be 32
This is not correct since we can verify that 14+18 not equals -32
So, there was an overflow.

3)
Number: 31
Let's convert this to two's complement binary
31
Since this is a positive number. we can directly convert this into binary
Divide 31 successively by 2 until the quotient is 0
   > 31/2 = 15, remainder is 1
   > 15/2 = 7, remainder is 1
   > 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 11111
So, 31 of decimal is 11111 in binary
so, 31 in 2's complement binary is 011111

Number: 5
Let's convert this to two's complement binary
5
Since this is a positive number. we can directly convert this into binary
Divide 5 successively by 2 until the quotient is 0
   > 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 101
So, 5 of decimal is 101 in binary
so, 5 in 2's complement binary is 000101

Adding 011111 and 000101 in binary
    011111
    000101
-----------
 (0)100100
-----------
Sum does not produces a carry
So, sum of these numbers in binary is 100100

Verification:
---------------
sum = 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
31+5 must be 36
This is not correct since we can verify that 31+5 not equals -28
So, there was an overflow.

Related Solutions

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
Find the decimal equivalents for the following 8-bit two’s complement numbers. a. 0010 0100 Decimal Equivalent...
Find the decimal equivalents for the following 8-bit two’s complement numbers. a. 0010 0100 Decimal Equivalent ___________ b. 1010 1001 Decimal Equivalent ___________ c. 1100 0011 Decimal Equivalent ___________ d. 0101 0101 Decimal Equivalent ___________
(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)
Evaluate the following expressions, where two’s complement numbers, A is 11111110 and B is 00000010 and...
Evaluate the following expressions, where two’s complement numbers, A is 11111110 and B is 00000010 and indicate the results. a. A + B b. A – B c. B–A d. –B e. – (-A)
Add or subtract the following 2’s complement form signed numbers, then convert the entire problem to...
Add or subtract the following 2’s complement form signed numbers, then convert the entire problem to decimal and confirm: 110110 + 111000 001100 – 011100
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
Represent (in binary and separately) the decimal signed whole numbers 347 and -347 in each of...
Represent (in binary and separately) the decimal signed whole numbers 347 and -347 in each of the following formats: (a) sign-magnitude. (b) 1's complement (c) 2's complement (d) excess-511 For Parts (a), (b) and (c), use the minimum number of bits necessary; for Part (d), use the same number of bits as in Parts (a), (b) and (c). CAUTION: You will earn NO CREDITS if you simply show the final result and not clearly show working (i.e., intermediate steps). (If...
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
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.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT