Binary

From SourceryForge

Jump to: navigation, search

Binary (also known as base-2) is a counting system based upon having only two symbols to represent digits, namely 0 (off) and 1 (on). Currently it is best known for its role in digital computing.

Binary numbers are based upon powers of two; that is, each binary digit indicates whether to add a different power of 2 or not. Using the sum of the powers of two any finite integer can be represented in binary; using more complicated methods any rational number of arbitrary precision can also be represented.

Binary numbers are based upon powers of two; that is, each binary digit indicates whether to add a different power of 2 or not. Using the sum of the powers of two any finite integer can be represented in binary; using more complicated methods any rational number of arbitrary precision can also be represented.

Contents

History

The earliest documented discussion of binary is Pingala's Chhandahshastra (conservatively estimated as written in the second century AD) which describes a way for classifying metres in songs using the numbers 0 and 1 to represent numbers. This system only differs from our current system in that it counts from 1, not 0, and it is represented in reverse order than modern binary. This sutra also discusses the algorithm for converting decimals to binary. (1)

Another milestone in binary was courtesy of Gottfried Wilhelm Leibniz (1646 - 1716), who started this work around AD 1666 after inspiration from I-Ching. Leibniz saw parallels between binary and such concepts as creation in Genesis (void/matter and dark/light both being binary concepts) and the holy trinity (Leibniz saw God as being 1, so using the mystical number 7, which in binary is represented as 111, you get the trinity). Regardless, Leibniz played with binary for a time, but didn't figure out any practical use for it.

The next major development for binary came from Boolean algebra, invented by George Boole (1815 - 1864). Augustus de Morgan (who taught Augusta Ada Byron, often cited as the first computer programmer) also worked at the same time to formalize logic as a mathematical discipline. Binary became a tool for logic, but it had yet to attach itself to the concept of computers.

Boolean algebra (and therefore binary) was finally entrenched in computing by Claude Shannon (who also invented information theory) when he replaced electromechanical parts with electrical circuits using the principles of Boolean logic.

How to read a binary number

As a rule, the "least significant bit" (LSB) is on the right hand side. Each 1 or 0 is a "bit". The least significant bit is the one that effects the value by the least amount (usually just "1"). The next bit is "2" then "4", "8" etc.

An 8 bit number is called a byte and is used to store values from 0 to 255.

Examples

(break every 4 bits for read-ability)

1101 0010
128 64 32 16     8 4 2 1
128+64+0 +16    +0+0+2+0   = 210


0000 0111
128 64 32 16     8 4 2 1
  0+ 0+0 + 0    +0+4+2+1   = 7

References

(1) B. van Nooten, "Binary Numbers in Indian Antiquity", Journal of Indian Studies, Volume 21, 1993, pp. 31-50

Related Pages

Personal tools