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.
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
Solve each of the following problems by translating the values into two’s complement notation (using patterns...
Solve each of the following problems by translating the values into two’s complement notation (using patterns of 5 bits), converting any subtraction problem to an equivalent addition problem, and performing that addition. Check your work by converting your answer to base 10 notation. (Watch out for overflow.) a. 5 + 1 b. 12 – 5 c. 5 – 11 d. 12 + 5 e. 5 – 1
Read four digits from the random numbers table. note the number of odd digits in the...
Read four digits from the random numbers table. note the number of odd digits in the selected numbers. Repeat the experiment 25 times. Obtain the probability distribution of the odd digits. Find mean and variance of the distribution
Implement a queue - C programming, please read the instruction carefully and implement queue.c using dynamic...
Implement a queue - C programming, please read the instruction carefully and implement queue.c using dynamic array structure given dynarray.h and dynarray.c below The second ADT you'll implement for this assignment is a queue. For this assignment, the interface for the queue (i.e. the structures and the prototypes of functions a user of the queue interacts with) is already defined for you in the file queue.h. Your first task in this assignment is to implement definitions for the functions that...
Please read the instructions and  find attached for the first wiki . Instructions for students: Read carefully...
Please read the instructions and  find attached for the first wiki . Instructions for students: Read carefully the attached document and then post your comments bearing in mind the following questions: 1- What are the pros and cons of rent controls? 2- Why economists disagree on the usefulness of rent control? 3- Do you believe rent control can help the poor? Edit Wiki Content rent control Rent regulation can take various forms, including rent control (the placing of a cap on...
Using the digits 2 through 8, find the number of different 5-digit numbers such that: (a)...
Using the digits 2 through 8, find the number of different 5-digit numbers such that: (a) Digits can be used more than once. (b) Digits cannot be repeated, but can come in any order. (c) Digits cannot be repeated and must be written in increasing order. (d) Which of the above counting questions is a combination and which is a permutation? Explain why this makes sense
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT