2.4: Adding Binary Whole Numbers
- Page ID
- 76100
The final topic before covering how integer values are stored and used in a computer for calculations is how to do addition of binary whole numbers.
When 2 one-bit binary numbers are added, the following results are possible: \(0_2+0_2 = 0_2; 0_2+1_2 = 1_2; 1_2+0_2 = 1_2;\) and \(1_2+1_2 = 10_2\). This is just like decimal numbers. For example, 3+4=7, and the result is still one digit. A problem occurs, however, when adding two decimal numbers where the result is greater than the base of the number (for decimal, the base is 10). For example, 9+8. The result cannot be represented in one digit, so a carry digit is created. The result of 9+8 is 7 with a carry of 1. The carry of 1 is considered in the addition for the next digit. This means that when adding two numbers together, adding the digits in the number requires 3 numbers (the two addends and the carry). So, 39 + 28 = 67, where the 10's digit (6) is the result of the two addends (3 and 2) and the carry (1).
The result of \(1_2+1_2 = 10_2\) in binary is analogous to the situation in base 10. The addition of \(1_2+1_2\) is \(0_2\) with a carry of \(1_2\) to the next digit.
An illustration of binary addition is shown in the figure below.
Figure 1: Binary whole number addition
Here the first bit adds \(1_2 + 1_2\), which yields a \(0_2\) in this bit and a carry bit of \(1_2\). The next bit now has to add \(1_2 +1_2 +1_2\) (the extra one is the carry bit), which yields a \(1_2\) for this bit and a carry bit of \(1_2\). If you follow the arithmetic through, you have \(0011_2\) (\(3_{10}\)) + \(0111_2 (7_{10}) = 1010_2 (10_{10})\).