Binary Subtraction Example

advertisement
Binary Subtraction
The four possibilities for subtraction are
0–0=0
1–1=0
1–0=1
0 – 1 = 1 and adjust columns to left in the number in the top row (as illustrated below).
Method: In the case of a column containing 0 – 1 put down 1 as the answer and in the top
row move to the left a column at a time changing every 0 to a 1 until a 1 is found, change
this 1 to a 0.
Example: Calculate 1001001 – 1111. (The column being subtracted is shown as shaded.)
Step 1: 1’s column
-
1 0 0 1 0 0 1
1 1 1 1
0
Step 2: 2’s column
0 1
1 0 0 1 0 0 1
1 1 1 1
← (row for adjustments to top number)
1 – 1 is 0
←
(row for adjustments to top number)
0 – 1 is 1, and move to left in top row and change
0 to 1 and to left again, change 1 to 0
←
(row for adjustments to top number)
1 -1 is 0
1 0
Step 3: 4’s column
0 1 1 0 1
1 0 0 1 0 0 1
1 1 1 1
0 1 0
Step 4: 8’s column
0 1 1 0 1
1 0 0 1 0 0 1
1 1 1 1
1 0 1 0
.
← (row for adjustments to top number)
0 – 1 is 1, and move to left and change 0 to 1, move to left
again, and change 0 to 1, and to left again and change 1 to 0
Step 5: Remaining 3 columns
0 1 1 0 1
←
1 0 0 1 0 0 1
1 1 1 1
-
(row for adjustments to top number)
the remaining subtractions are all – 0,.
0 1 1 1 0 1 0
Drop the leading 0 (at the start of the number) to give the result as 111010
Note: I consider the above method easiest – you choose the method with which you are
most comfortable.
Download