Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Binary number
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Addition=== {{main | Adder (electronics)}} [[Image:Half Adder.svg|thumbnail|200px|right|The [[circuit diagram]] for a binary [[Adder (electronics)|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 = 2 = 0 + (1 Γ 2<sup>1</sup>) ) 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 = 0 + (1 Γ 10<sup>1</sup>) ) :7 + 9 β 6, carry 1 (since 7 + 9 = 16 = 6 + (1 Γ 10<sup>1</sup>) ) 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: {{brown|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: 01101<sub>2</sub> (13<sub>10</sub>) and 10111<sub>2</sub> (23<sub>10</sub>). The top row shows the carry bits used. Starting in the rightmost column, 1 + 1 = 10<sub>2</sub>. 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 = 10<sub>2</sub> again; the 1 is carried, and 0 is written at the bottom. The third column: 1 + 1 + 1 = 11<sub>2</sub>. This time, a 1 is carried, and a 1 is written in the bottom row. Proceeding like this gives the final answer 100100<sub>2</sub> (36<sub>10</sub>). When computers must add two numbers, the rule that: x [[Exclusive or|xor]] y = (x + y) [[Modulo operation|mod]] 2 for any two bits x and y allows for very fast calculation, as well. ====Long carry method==== A simplification for many binary addition problems is the "long carry method" or "Brookhouse Method of Binary Addition". This method is particularly useful when one of the numbers contains a long stretch of ones. It is based on the simple premise that under the binary system, when given a stretch of digits composed entirely of {{varserif|n}} ones (where {{varserif|n}} is any integer length), adding 1 will result in the number 1 followed by a string of {{varserif|n}} zeros. That concept follows, logically, just as in the decimal system, where adding 1 to a string of {{varserif|n}} 9s will result in the number 1 followed by a string of {{varserif|n}} 0s: Binary Decimal 1 1 1 1 1 likewise 9 9 9 9 9 + 1 + 1 βββββββββββ βββββββββββ 1 0 0 0 0 0 1 0 0 0 0 0 Such long strings are quite common in the binary system. From that one finds that large binary numbers can be added using two simple steps, without excessive carry operations. In the following example, two numerals are being added together: 1 1 1 0 1 1 1 1 1 0<sub>2</sub> (958<sub>10</sub>) and 1 0 1 0 1 1 0 0 1 1<sub>2</sub> (691<sub>10</sub>), using the traditional carry method on the left, and the long carry method on the right: Traditional Carry Method Long Carry Method vs. {{brown|1 1 1 1 1 1 1 1 (carried digits) 1 β 1 β}} carry the 1 until it is one digit past the "string" below 1 1 1 0 1 1 1 1 1 0 <s>1 1 1</s> 0 <s>1 1 1 1 1</s> 0 cross out the "string", + 1 0 1 0 1 1 0 0 1 1 + 1 0 <s>1</s> 0 1 1 0 0 <s>1</s> 1 and cross out the digit that was added to it βββββββββββββββββββββββ ββββββββββββββββββββββ = 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 0 0 1 The top row shows the carry bits used. Instead of the standard carry from one column to the next, the lowest-ordered "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. The "used" numbers must be crossed off, since they are already added. Other long strings may likewise be cancelled using the same technique. Then, simply add together any remaining digits normally. Proceeding in this manner gives the final answer of 1 1 0 0 1 1 1 0 0 0 1<sub>2</sub> (1649<sub>10</sub>). In our simple example using small numbers, the traditional carry method required eight carry operations, yet the long carry method required only two, representing a substantial reduction of effort. ====Addition table==== {| class="wikitable" style="text-align:center" |- ! style="width:1.5em" | ! style="width:1.5em" | 0 ! style="width:1.5em" | 1 |- ! 0 | 0 | 1 |- ! 1 | 1 | 10 |} The binary addition table is similar to, but not the same as, the [[Logical disjunction#Truth table|truth table]] of the [[logical disjunction]] operation <math>\lor</math>. The difference is that <math>1 \lor 1 = 1</math>, while <math>1+1=10</math>.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)