Ad Code

Why we use complement in subtraction ?

Why we use complement in subtraction ?
also explain fractional conversion for binary how can we convert decimal fraction into binary fraction by division method and sum of weights ?


Answer to first part of your question:

Computer do only addition of binary numbers and there is no circuitry to perform subtraction so to achieve the purpose of subtraction we play a trick,we take -ve of second number by 2's complement method and then add it to first number. In this way we subtract two numbers by addition.

Answer to second part: 
Suppose you want to convert a decimal fraction .625 into binary. Follow the following steps
Step 1: Begin with the decimal fraction and multiply by 2. The whole number part of the result is the first binary digit to the right of the point.
.625 x 2 = 1.25, the first binary digit to the right of the point is a 1.

Step 2: Next we disregard the whole number part of the previous result (the 1 in this case) and multiply by 2 once again. The whole number part of this new result is the second binary digit to the right of the point.
.25 x 2 = 0.50, the second binary digit to the right of the point is a 0.

Step 3: Disregarding the whole number part of the previous result, we multiply by 2 once again. The whole number part of the result is now the next binary digit to the right of the point.
.50 x 2 = 1.00, the third binary digit to the right of the point is a 1.

Step 4: In fact, we do not need a Step 4. We are finished in Step 3, because we had 0 as the fractional part of our result there.
Hence the representation of .625 = .1012
Reactions

Post a Comment

0 Comments