![]() |
![]() |
|
![]() |
![]() |
Encyclopedia :
B :
BI :
BIN :
Binary numeral system |
|
|
Binary numeral systemThe binary or base-two numeral system is a system for representing numbers in which a radix of two is used; that is, each digit in a binary numeral may have either of two different values. Typically, the symbols 0 and 1 are used to represent binary numbers. Owing to its relatively straightforward implementation in electronic circuitry, the binary system is used internally by virtually all modern computers. OverviewSince binary numerals use a radix of two, written binary numbers require two symbols, typically 0 and 1. By way of comparison, the decimal numeral system uses a radix of ten, and requires ten symbols, 0 through 9. In the binary system, all numbers larger than one require more digits to write than they would in the decimal system. The number two is written "10" in binary; the number six requires three digits in binary, "110"; and the number nine-hundred ninety-nine (decimal "999") requires ten digits in binary, "1111100111". This extra length makes binary somewhat cumbersome for humans, so those who frequently work with binary numerals may use higher radix systems like octal, where each octal digit represents 3 binary digits, or hexadecimal, which compresses binary numbers by a factor of 4. HistoryThe first known description of a binary numeral system was made by Pingala in his Chhandah-shastra, placed variously in the 5th century BC or the 2nd century BC. Pingala described the binary numeral system in connection with the listing of Vedic meters with short or long syllables. According to one Indian tradition, Pingala was the younger brother of the grammarian Panini. Although the British philosopher Francis Bacon had earlier described a developed system of concealed binary encoding for encryption, the modern binary number system was first fully documented by Gottfried Leibniz in the 17th century in his article Explication de l'Arithmétique Binaire. While Pingala's system uses the values 1 and 2, Leibniz's uses 0 and 1, like the modern binary numeral system. In 1854, British mathematician George Boole published a landmark paper detailing a system of logic that would become known as Boolean algebra. His logical system proved instrumental in the development of the binary system, particularly in its implementation in electronic circuitry. In 1937, Claude Shannon produced his master's thesis at MIT that implemented Boolean algebra and binary arithmetic using electronic relays and switches for the first time in history. Entitled A Symbolic Analysis of Relay and Switching Circuits, Shannon's thesis essentially founded practical digital circuit design. In November of 1937, George Stibitz, then working at Bell Labs, completed a relay-based computer he dubbed the "Model K" (for "kitchen", where he had assembled it), which calculated using binary addition. Bell Labs thus authorized a full research program in late 1938 with Stibitz at the helm. Their Complex Number Computer, completed January 8, 1940, was able to calculate complex numbers. In a demonstration to the American Mathematical Society conference at Dartmouth College on September 11, 1940, Stibbitz was able to send the Complex Number Calculator remote commands over telephone lines by a teletype. It was the first computing machine ever used remotely over a phone line. Some participants of the conference who witnessed the demonstration were John Von Neumann, John Mauchly, and Norbert Wiener, who wrote about it in his memoirs. RepresentationA binary number can be represented by any sequence of bits (binary digits), which in turn may be represented by any mechanism capable of being in two mutually exclusive states. The following sequences of symbols could all be interpreted as different binary numeric values: 11010011 on off off on off on - | - | | - | - - | - | o x o o x o o x N Y N N Y N Y Y Y true false false true true false The numeric value represented in each case is dependent upon the value assigned to each symbol. In a computer, the numeric values may be represented by two different voltages; on a magnetic disk, magnetic polarities may be used. A "positive", "yes", or "on" state is not necessarily equivalent to the numerical value of one; it depends on the architecture in use. In keeping with customary representation of numerals using arabic numerals, binary numbers are commonly written using the symbols 0 and 1. When written, binary numerals are often subscripted or suffixed in order to indicate their base, or radix. The following notations are equivalent:
Counting in binaryCounting in binary is similar to counting in any other number system. Beginning with a single digit, counting proceeds through each symbol, in increasing order. Decimal counting uses the symbols 0 through 9, while binary only uses the symbols 0 and 1. When the symbols for the first digit are exhausted, the next-higher digit (to the left) is incremented, and counting starts over at 0. In decimal, counting proceeds like so:
AdditionThe simplest arithmetic operation in binary is addition. Adding two single-digit binary numbers is relatively simple:
1 1 1 1 (carry)
0 1 1 0 1
+ 1 0 1 1 1
-------------
= 1 0 0 1 0 0
In this example, two numerals are being added together: 01101 (13 decimal) and 10111 (23 decimal). The top row shows the carry bits used. Starting in the rightmost column, 1 + 1 = 10. 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 again; the 1 is carried, and 0 is written at the bottom. The third column: 1 + 1 + 1 = 11. This time, a 1 is carried, and a 1 is written in the bottom row. Proceeding like this gives the final answer 100100. SubtractionSubtraction works in much the same way:
* * * * (starred columns are borrowed from)
1 1 0 1 1 1 0
- 1 0 1 1 1
----------------
= 1 0 1 0 1 1 1
Subtracting a positive number is equivalent to adding a negative number of equal absolute value; computers typically use the two's complement notation to represent negative values. This notation eliminates the need for a separate "subtract" operation. For further details, see two's complement. MultiplicationMultiplication in binary is similar to its decimal counterpart. Two numbers A and B can be multiplied by partial products: for each digit in B, the product of that digit in A is calculated and written on a new line, shifted leftward so that its rightmost digit lines up with the digit in B that was used. The sum of all these partial products gives the final result. Since there are only two digits in binary, there are only two possible outcomes of each partial multiplication:
1 0 1 1 (A) × 1 0 1 0 (B) --------- 0 0 0 0 ← Corresponds to a zero in B 1 0 1 1 ← Corresponds to a one in B 0 0 0 0 + 1 0 1 1 --------------- = 1 1 0 1 1 1 0 DivisionBinary division is again similar to its decimal counterpart:__________ 1 0 1 | 1 1 0 1 1 Here, the divisor is 101, or 5 decimal, while the dividend is 11011, or 27 decimal. The procedure is the same as that of decimal long division; here, the divisor 101 goes into the first three digits 110 of the dividend one time, so a "1" is written on the top line. This result is multiplied by the divisor, and subtracted from the first three digits of the dividend; the next digit (a "1") is included to obtain a new three-digit sequence: 1 __________ 1 0 1 | 1 1 0 1 1 - 1 0 1 ----- 0 1 1 The procedure is then repeated with the new sequence, continuing until the digits in the dividend have been exhausted: 1 0 1
__________
1 0 1 | 1 1 0 1 1
- 1 0 1
-----
0 1 1
- 0 0 0
-----
1 1 1
- 1 0 1
-----
1 0
Thus, the quotient of 11011 divided by 101 is 1012, as shown on the top line, while the remainder, shown on the bottom line, is 102. In decimal, 27 divided by 5 is 5, with a remainder of 2. Bitwise logical operations Though not directly related to the numerical interpretation of binary symbols, sequences of bits may be manipulated using Boolean logical operators. When a string of binary symbols are manipulated in this way, it is called a bitwise operation; the logical operators AND, OR, and XOR may be performed on corresponding bits in two binary numerals provided as input. The logical NOT operation may be performed on individual bits in a single binary numeral provided as input. Sometimes, such operations may be used as arithmetic short-cuts, and may have other computational benefits as well. See Bitwise operation. Conversion to and from other numeral systemsDecimalThis method works for conversion from any base, but there are better methods for bases which are powers of two, such as octal and hexadecimal given below. In place-value numeral systems, digits in successively lower, or less significant, positions represent successively smaller powers of the radix. The starting exponent is one less than the number of digits in the number. A five-digit number would start with an exponent of four. In the decimal system, the radix is 10 (ten), so the left-most digit of a five-digit number represents the 104 (ten thousands) position. Consider:
For example, 11810, in binary, is:
In a fractional binary number such as .110101101012, the first digit is 1/2, the second 1/22, etc. So if there is a 1 in the first place after the decimal, then the number is at least 1/2, and vice versa. Double that number is at least 1. This suggests the algorithm: Repeatedly double the number to be converted, record if the result is at least 1, and then throw away the integer part. For example, (1/3)10, in binary, is: Or for example, 0.110, in binary, is:
HexadecimalBinary may be converted to and from hexadecimal somewhat more easily. This is due to the fact that the radix of the hexadecimal system (16) is a power of the radix of the binary system (2). More specifically, 16 = 24, so it takes exactly four digits of binary to represent one digit of hexadecimal. The following table shows each hexadecimal digit along with the equivalent four-digit binary sequence: To convert a hexadecimal number into its binary equivalent, simply substitute the corresponding binary digits:
All dyadic rational numberss p/2a have a terminating binary numeral -- the binary representation has only finitely many terms after the radix point. Other rational numbers have binary representation, but instead of terminating, they recur, with a finite sequence of digits repeating indefinitely. For instance Binary numerals which neither terminate nor recur represent irrational numbers. For instance, See alsoExternal links
|
|
|
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License. |
|
| © 2008 Chamas Enterprises Inc. |