Jump to content

Binary code

From Wikipedia, the free encyclopedia
(Redirected from Binary encoding)
The ASCII-encoded letters of "Wikipedia" represented as binary codes.
Values represented in binary, hex and decimal

A binary code is the value of a data-encoding convention represented in a binary notation that usually is a sequence of 0s and 1s; sometimes called a bit string. For example, ASCII is an 8-bit text encoding that in addition to the human readable form (letters) can be represented as binary. Binary code can also refer to the mass noun code that is not human readable in nature such as machine code and bytecode.

Even though all modern computer data is binary in nature, and therefore, can be represented as binary, other numerical bases are usually used. Power of 2 bases (including hex and octal) are sometimes considered binary code since their power-of-2 nature makes them inherently linked to binary. Decimal is, of course, a commonly used representation. For example, ASCII characters are often represented as either decimal or hex. Some types of data such as image data is sometimes represented as hex, but rarely as decimal.

History

[edit]
Gottfried Leibniz

Invention

[edit]

The modern binary number system, the basis for binary code, is an invention by Gottfried Leibniz in 1689 and appears in his article Explication de l'Arithmétique Binaire (English: Explanation of the Binary Arithmetic) which uses only the characters 1 and 0, and some remarks on its usefulness. Leibniz's system uses 0 and 1, like the modern binary numeral system. Binary numerals were central to Leibniz's intellectual and theological ideas. He believed that binary numbers were symbolic of the Christian idea of creatio ex nihilo or creation out of nothing.[1][2] In Leibniz's view, binary numbers represented a fundamental form of creation, reflecting the simplicity and unity of the divine.[2] Leibniz was also attempting to find a way to translate logical reasoning into pure mathematics. He viewed the binary system as a means of simplifying complex logical and mathematical processes, believing that it could be used to express all concepts of arithmetic and logic.[2]

Previous Ideas

[edit]

Leibniz explained in his work that he encountered the I Ching by Fu Xi[2] that dates from the 9th century BC in China,[3] through French Jesuit Joachim Bouvet and noted with fascination how its hexagrams correspond to the binary numbers from 0 to 111111, and concluded that this mapping was evidence of major Chinese accomplishments in the sort of philosophical visual binary mathematics he admired.[4][5] Leibniz saw the hexagrams as an affirmation of the universality of his own religious belief.[5] After Leibniz ideas were ignored, the book had confirmed his theory that life could be simplified or reduced down to a series of straightforward propositions. He created a system consisting of rows of zeros and ones. During this time period, Leibniz had not yet found a use for this system.[6] The binary system of the I Ching is based on the duality of yin and yang.[7] Slit drums with binary tones are used to encode messages across Africa and Asia.[7] The Indian scholar Pingala (around 5th–2nd centuries BC) developed a binary system for describing prosody in his Chandashutram.[8][9]

Mangareva people in French Polynesia were using a hybrid binary-decimal system before 1450.[10] In the 11th century, scholar and philosopher Shao Yong developed a method for arranging the hexagrams which corresponds, albeit unintentionally, to the sequence 0 to 63, as represented in binary, with yin as 0, yang as 1 and the least significant bit on top. The ordering is also the lexicographical order on sextuples of elements chosen from a two-element set.[11]

George Boole

In 1605 Francis Bacon discussed a system whereby letters of the alphabet could be reduced to sequences of binary digits, which could then be encoded as scarcely visible variations in the font in any random text.[12] Importantly for the general theory of binary encoding, he added that this method could be used with any objects at all: "provided those objects be capable of a twofold difference only; as by Bells, by Trumpets, by Lights and Torches, by the report of Muskets, and any instruments of like nature".[12]

Boolean Logical System

[edit]

George Boole published a paper in 1847 called 'The Mathematical Analysis of Logic' that describes an algebraic system of logic, now known as Boolean algebra. Boole's system was based on binary, a yes-no, on-off approach that consisted of the three most basic operations: AND, OR, and NOT.[13] This system was not put into use until a graduate student from Massachusetts Institute of Technology, Claude Shannon, noticed that the Boolean algebra he learned was similar to an electric circuit. In 1937, Shannon wrote his master's thesis, A Symbolic Analysis of Relay and Switching Circuits, which implemented his findings. Shannon's thesis became a starting point for the use of the binary code in practical applications such as computers, electric circuits, and more.[14]

Timeline

[edit]

Rendering

[edit]
Daoist Bagua

A binary code can be rendered using any two distinguishable indications. In addition to the bit string, other notable ways to render a binary code are described below.

Braille
Braille is a binary code that is widely used to enable the blind to read and write by touch. The system consists of grids of six dots each, three per column, in which each dot is either raised or flat (not raised). The different combinations of raised and flat dots encode information such as letters, numbers, and punctuation.
Bagua
The bagua is a set of diagrams used in feng shui, Taoist cosmology and I Ching studies. The ba gua consists of 8 trigrams; each a combination of three lines (yáo) that are either broken (yin) or unbroken (yang).[16]
Ifá
The Ifá/Ifé system of divination in African religions, such as of Yoruba, Igbo, and Ewe, consists of an elaborate traditional ceremony producing 256 oracles made up by 16 symbols with 256 = 16 x 16. A priest, or Babalawo, requests sacrifice from consulting clients and makes prayers. Then, divination nuts or a pair of chains are used to produce random binary numbers,[17] which are drawn with sandy material on an "Opun" figured wooden tray representing the totality of fate.[18]

Encoding

[edit]
An example of a recursive binary space partitioning quadtree for a 2D index

Innumerable encoding systems exists. Some notable examples are described here.

ASCII
The American Standard Code for Information Interchange (ASCII) character encoding, is a 7-bit convention for representing (normal/printing) characters and control operations. Each printing and control character is assigned a number from 0 to 127. For example, "a" is represented by decimal code 97 which is rendered as bit string 1100001.
Binary-coded decimal
Binary-coded decimal (BCD) is an encoding of integer values that consists of a 4-bit nibble for each decimal digit. As a decimal digit is only 1 of 10 values (0 to 9) but 4 bits can encode up to 16 values, and BCD element is invalid for a value greater than 9.[19]

See also

[edit]

References

[edit]
  1. ^ Yuen-Ting Lai (1998). Leibniz, Mysticism and Religion. Springer. pp. 149–150. ISBN 978-0-7923-5223-5.
  2. ^ a b c d Leibniz G., Explication de l'Arithmétique Binaire, Die Mathematische Schriften, ed. C. Gerhardt, Berlin 1879, vol.7, p.223; Engl. transl.[1]
  3. ^ Edward Hacker; Steve Moore; Lorraine Patsco (2002). I Ching: An Annotated Bibliography. Routledge. p. 13. ISBN 978-0-415-93969-0.
  4. ^ Aiton, Eric J. (1985). Leibniz: A Biography. Taylor & Francis. pp. 245–8. ISBN 978-0-85274-470-3.
  5. ^ a b J.E.H. Smith (2008). Leibniz: What Kind of Rationalist?: What Kind of Rationalist?. Springer. p. 415. ISBN 978-1-4020-8668-7.
  6. ^ "Gottfried Wilhelm Leibniz (1646 - 1716)". www.kerryr.net.
  7. ^ a b Jonathan Shectman (2003). Groundbreaking Scientific Experiments, Inventions, and Discoveries of the 18th Century. Greenwood Publishing. p. 29. ISBN 978-0-313-32015-6.
  8. ^ Sanchez, Julio; Canton, Maria P. (2007). Microcontroller programming: the microchip PIC. Boca Raton, Florida: CRC Press. p. 37. ISBN 978-0-8493-7189-9.
  9. ^ W. S. Anglin and J. Lambek, The Heritage of Thales, Springer, 1995, ISBN 0-387-94544-X
  10. ^ Bender, Andrea; Beller, Sieghard (16 December 2013). "Mangarevan invention of binary steps for easier calculation". Proceedings of the National Academy of Sciences. 111 (4): 1322–1327. doi:10.1073/pnas.1309160110. PMC 3910603. PMID 24344278.
  11. ^ Ryan, James A. (January 1996). "Leibniz' Binary System and Shao Yong's "Yijing"". Philosophy East and West. 46 (1): 59–90. doi:10.2307/1399337. JSTOR 1399337.
  12. ^ a b Bacon, Francis (1605). "The Advancement of Learning". London. pp. Chapter 1.
  13. ^ "What's So Logical About Boolean Algebra?". www.kerryr.net.
  14. ^ "Claude Shannon (1916 - 2001)". www.kerryr.net.
  15. ^ a b c Glaser 1971
  16. ^ Wilhelm, Richard (1950). The I Ching or Book of Changes. trans. by Cary F. Baynes, foreword by C. G. Jung, preface to 3rd ed. by Hellmut Wilhelm (1967). Princeton, NJ: Princeton University Press. pp. 266, 269. ISBN 978-0-691-09750-3. {{cite book}}: ISBN / Date incompatibility (help)
  17. ^ Olupona, Jacob K. (2014). African Religions: A Very Short Introduction. Oxford: Oxford University Press. p. 45. ISBN 978-0-19-979058-6. OCLC 839396781.
  18. ^ Eglash, Ron (June 2007). "The fractals at the heart of African designs". www.ted.com. Archived from the original on 2021-07-27. Retrieved 2021-04-15.
  19. ^ Cowlishaw, Mike F. (2015) [1981, 2008]. "General Decimal Arithmetic". IBM. Retrieved 2016-01-02.
[edit]