Question

In: Computer Science

Please read carefully. Using the minimum number of digits in 2’s complement notation, perform 25 –...

Please read carefully. Using the minimum number of digits in 2’s complement notation, perform 25 – 18 (subtraction by preserving addition). Show all the significant steps in your work by indicating the starting values, sign conversion and the addition operation aligning all numbers including the carry values in each position using the Courier New font. Indicate the final value as a decimal.

Solutions

Expert Solution

to represent 25, or -18 we need 6 bits.
so, using 6 bits for calculations..

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

Number: -18
Let's convert this to two's complement binary
-18
This is negative. so, follow these steps to convert this into a 2's complement binary
Step 1:
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 normal binary is 010010
Step 2: flip all the bits. Flip all 0's to 1 and all 1's to 0.
   010010 is flipped to 101101
Step 3:. Add 1 to above result
101101 + 1 = 101110
so, -18 in 2's complement binary is 101110

Adding 011001 and 101110 in binary
(c)1110000  <-  these are carry bits for the calculation. 
    011001
    101110
-----------
 (1)000111
-----------
Sum produces a carry of 1. We can ignore that carry.
So, sum of these numbers in binary is 000111

Verification:
---------------
sum = 000111
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 111 to decimal
111
=> 1x2^2+1x2^1+1x2^0
=> 1x4+1x2+1x1
=> 4+2+1
=> 7
Answer: 7

This is correct since we can verify that 25+-18 = 7
So, there was no overflow.

Related Solutions

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
Write -127 as 8 bit signed binary number both using 2'complement and sign/magnitude notation.
Write -127 as 8 bit signed binary number both using 2'complement and sign/magnitude notation.
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.
The standard method of representing negative numbers in the binary system is with 2's complement notation....
The standard method of representing negative numbers in the binary system is with 2's complement notation. What are the advantages and disadvantages of using this method to represent negative numbers?
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also...
add the following numbers using 16-bit 2's complement. show all the steps and calculations. Please also show steps to verify that the answer is correct. -7493 and -6372
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