How to subtract binary numbers

How to subtract binary numbers

Articles Hits: 64

Binary arithmetics represents the same set of mathematical operations and rules, as any other, with one exception – numbers over which they are made, consist only of two symbols - 0 and 1.

Instruction

1. Binary algebra – fundamentals of computer science therefore the course of this subject always begins with actions over such numbers. It is very important that pupils understood material, any programming language as computers and other equipment understand only such code is based on it.

2. It is possible to subtract binary numbers in two ways: in a column and with use of the additional code of number. The first is implemented just as and in more habitual decimal system. Operation is performed porazryadno, if necessary unit from the senior is engaged. The second way means reduction of subtraction to addition.

3. Consider for a start the first method. Solve an example: to find the difference of numbers 1101 and 110. Begin action with the younger category, i.e. from right to left: 1 – 0 = 10 – 1 =?.

4. Occupy unit from the senior category. As one position in binary number represents decimal number 2, action will be transformed to 2 – 1 = 1. Remember that in the third category there was zero, therefore, again borrow unit from the senior category: 2 – 1 = 1. So, the number turned out: 1101 – 110 = 111.

5. Check result by means of transfer to a decimal numeral system: 1101 = 13, 110 = 6, and 111 = 7. Everything is right.

6. Solve the following example by the second method: 100010 – 10110.

7. Transform a subtrahend to the following look: make replacement of all zero by units and vice versa, add unit to the younger category: 10110 → 01001 + 00001 = 01010.

8. Put the turned-out result with the first in an example. Addition in binary arithmetics is carried out porazryadno: 0+0=0; 0+1=1+0=1; 1+1 = 0 and 1 "in mind", i.e. increases to result upon transition to the following position of number: 100010 + 01010 = 101100.

9. Reject the senior unit and non-significant zero and receive: 1100. It is also the answer. Transfer all action to a decimal look to make check: 100010_2=34_10; 10110_2=22_10 → 34-22 = 12=1100.

Author: «MirrorInfo» Dream Team

Print