Binary arithmetic is fundamental to all digital computers and most other digital systems. In particular, addition is the most important binary arithmetic process because it can be used to perform all other arithmetic operations such as subtraction, multiplication and division. Thus it is important to fully understand binary addition. Table 2-3 shows the four basic rules for binary addition.
Addition Rules |
||
A+B |
Sum |
Carry |
0+0 |
0 |
0 |
0+1 |
1 |
0 |
1+0 |
1 |
0 |
1+1 |
0 |
1 |
Table 2-3 Binary Arithmetic Addition Rules
Note A+B here refers to the addition of the binary numbers and not the OR Function |
1)
Decimal |
Binary |
5 |
101 |
+3 |
+ 011 |
8 |
1000 |
2)
Decimal |
Binary |
74 |
1001010 |
+19 |
+ 10011 |
93 |
1011101 |
The process of binary subtraction may be viewed as the addition of a negative number. For example 9-4 may be viewed as 9 +(-4). However to determine the negative representation of a binary number, one must become familiar with 1s and 2s complement.
The 1s complement of binary number is found by changing all the 1s to 0s and vice versa as illustrated by the examples below:
Number |
1s Complement |
10001 |
01110 |
101001 |
010110 |
The 2s complement of binary number is found by adding 1 to the 1s complement representation as illustrated by the examples below:
Number |
1s Complement |
2s Complement |
10001 |
01110 |
01111 |
101001 |
010110 |
010111 |
For subtracting a smaller number from a larger number, the 1s complement method is as follows:
- Determine the 1s complement of the smaller number.
- Add the 1s complement to the larger number.
- Remove the final carry and add it to the result. This step is called the end-around carry.
Example:
1100110011
Result from Step1: 01100
Result from Step2: 100101
Result from Step3: 00110
To verify, note that 25 - 19 = 6
For subtracting a larger number from a smaller number, the 1s complement method is as follows:
- Determine the 1s complement of the larger number.
- Add the 1s complement to the smaller number.
- There is no carry. The result has the opposite sign from the answer and is the 1s complement of the answer.
- Change the sign and take the 1s complement of the result to get the final answer.
Example:
1001 1101
Result from Step1: 0010
Result from Step2: 1011
Result from Step3: -0100
To verify, note that 9 - 13 = -4
For subtracting a smaller number from a larger number, the 2s complement method is as follows:
- Determine the 2s complement of the smaller number.
- Add the 2s complement to the larger number.
- Discard the final carry (there is always one in this case)
Example:
11001 10011
Result from Step1: 01101
Result from Step2: 100110
Result from Step3: 00110
Again, to verify, note that 25 - 19 = 6
For subtracting a larger number from a smaller number, the 2s complement method is as follows:
- Determine the 2s complement of the larger number.
- Add the 2s complement to the smaller number.
- There is no carry from the left-most column. The result is in 2s complement form and is negative.
- Change the sign and take the 2s complement of the result to get the final answer.
Example:
1001 1101
Result from Step1: 0011
Result from Step2: 1100
Result from Step3: -0100
Again to verify, note that 9 - 13 = -4
Copyright © Adrian Als , 1999
This page was last modified: Wednesday, April 12, 2000