Binary Arithmetic

Topics: Binary numeral system, Elementary arithmetic, Addition Pages: 10 (2208 words) Published: February 27, 2013
Binary arithmetic
Arithmetic in binary is much like arithmetic in other numeral systems. Addition, subtraction, multiplication, and division can be performed on binary numerals. Addition

The circuit diagram for a binary half adder, which adds two bits together, producing sum and carry bits. The simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple, using a form of carrying: 0 + 0 → 0

0 + 1 → 1
1 + 0 → 1
1 + 1 → 0, carry 1 (since 1 + 1 = 0 + 1 × binary 10)
Adding two "1" digits produces a digit "0", while 1 will have to be added to the next column. This is similar to what happens in decimal when certain single-digit numbers are added together; if the result equals or exceeds the value of the radix (10), the digit to the left is incremented: 5 + 5 → 0, carry 1 (since 5 + 5 = 10 carry 1)

7 + 9 → 6, carry 1 (since 7 + 9 = 16 carry 1)
This is known as carrying. When the result of an addition exceeds the value of a digit, the procedure is to "carry" the excess amount divided by the radix (that is, 10/10) to the left, adding it to the next positional value. This is correct since the next position has a weight that is higher by a factor equal to the radix. Carrying works the same way in binary:

1 1 1 1 1 (carried digits)
0 1 1 0 1
+ 1 0 1 1 1
-------------
= 1 0 0 1 0 0 = 36
In this example, two numerals are being added together: 011012 (1310) and 101112 (2310). The top row shows the carry bits used. Starting in the rightmost column, 1 + 1 = 102. The 1 is carried to the left, and the 0 is written at the bottom of the rightmost column. The second column from the right is added: 1 + 0 + 1 = 102 again; the 1 is carried, and 0 is written at the bottom. The third column: 1 + 1 + 1 = 112. This time, a 1 is carried, and a 1 is written in the bottom row. Proceeding like this gives the final answer 1001002 (36 decimal). When computers must add two numbers, the rule that: x xor y = (x + y) mod 2 for any two bits x and y allows for very fast calculation, as well. A simplification for many binary addition problems is the Long Carry Method or Brookhouse Method of Binary Addition. This method is generally useful in any binary addition where one of the numbers has a long string of “1” digits. For example the following large binary numbers can be added in two simple steps without multiple carries from one place to the next.

1 1 1 1 1 1 1 1 (carried digits) (Long Carry Method)
1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0
+ 1 0 1 0 1 1 0 0 1 1 Versus: + 1 0 1 0 1 1 0 0 1 1 add crossed out digits first
----------------------- + 1 0 0 0 1 0 0 0 0 0 0 = sum of crossed out digits
= 1 1 0 0 1 1 1 0 0 0 1 ----------------------- now add remaining digits
1 1 0 0 1 1 1 0 0 0 1 In this example, two numerals are being added together: 1 1 1 0 1 1 1 1 1 02 (95810) and 1 0 1 0 1 1 0 0 1 12 (69110). The top row shows the carry bits used. Instead of the standard carry from one column to the next, the lowest place-valued "1" with a "1" in the corresponding place value beneath it may be added and a "1" may be carried to one digit past the end of the series. These numbers must be crossed off since they are already added. Then simply add that result to the uncanceled digits in the second row. Proceeding like this gives the final answer 1 1 0 0 1 1 1 0 0 0 12 (164910). Addition table

| 0| 1|
0| 0| 1|
1| 1| 10|
The binary addition table is similar, but not the same, as the truth table of the logical disjunction operation . The difference is that , while . Subtraction
Subtraction works in much the same way:
0 − 0 → 0
0 − 1 → 1, borrow...