Binary code: Difference between revisions

Content deleted Content added
Tag: Reverted
it's broader and looser than a just machine code and bytecode
 
(13 intermediate revisions by 2 users not shown)
Line 1:
{{Short description|Encoding for|Encoded data, usingrepresented 0sin andbinary 1snotation}}
{{For|the binary form of computer software|Machine code}}
[[Image:Wikipedia in binary.gif|thumb |The wordASCII-encoded 'letters of "Wikipedia'" represented in [[ASCII]]as binary code, made up of 9 bytes (72 bits)codes.]]
[[FileImage:Binary to Hexadecimal or Decimal.jpg|thumb |BinaryValues torepresented Hexadecimalin orbinary, Decimalhex and decimal]]
A '''binary code''' represents [[plain text|text]], [[instruction set|computer processor instructions]], or any other [[data]] using a two-symbol system. The two-symbol system used is often "0" and "1" from the [[binary number|binary number system]]. The binary code assigns a pattern of binary digits, also known as [[bit]]s, to each character, instruction, etc. For example, a binary [[string (computer science)|string]] of eight bits (which is also called a byte) can represent any of 256 possible values and can, therefore, represent a wide variety of different items.
A '''binary code''' is the value of a [[data encoding |data-encoding]] convention represented in a [[Binary number |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 base]]s are usually used. [[Power of 2]] bases (including [[hexadecimal |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.
In computing and telecommunications, binary codes are used for various methods of [[encoding]] data, such as [[character string]]s, into bit strings. Those methods may use fixed-width or [[variable-length code|variable-width]] strings. In a fixed-width binary code, each letter, digit, or other character is represented by a bit string of the same length; that bit string, interpreted as a [[binary number]], is usually displayed in code tables in [[octal]], [[decimal]] or [[hexadecimal]] notation. There are many [[character sets]] and many [[character encoding]]s for them.
[[File:Binary to Hexadecimal or Decimal.jpg|thumb|Binary to Hexadecimal or Decimal]]
 
==History of binary codes==
A [[bit string]], interpreted as a binary number, can be [[binary number#Decimal|translated into a decimal number]]. For example, the [[letter case|lower case]] ''a'', if represented by the bit string <code>01100001</code> (as it is in the standard [[ASCII]] code), can also be represented as the decimal number 97.
 
==History of binary codes==
{{further|Binary number#History}}
{{Disputed section|date=April 2015}}
Line 16 ⟶ 14:
=== Invention ===
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.<ref name="on">{{cite book |author1=Yuen-Ting Lai |url=https://books.google.com/books?id=U9dOmVt81UAC&pg=PA149 |title=Leibniz, Mysticism and Religion |publisher=Springer |year=1998 |isbn=978-0-7923-5223-5 |pages=149–150}}</ref><ref name="lnz">Leibniz G., Explication de l'Arithmétique Binaire, Die Mathematische Schriften, ed. C. Gerhardt, Berlin 1879, vol.7, p.223; Engl. transl.[http://www.leibniz-translations.com/binary.htm]</ref> In Leibniz's view, binary numbers represented a fundamental form of creation, reflecting the simplicity and unity of the divine.<ref name="lnz" /> 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.<ref name="lnz" />
does editing work?
 
=== Previous Ideas ===
Line 28 ⟶ 25:
[[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 (logic)|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.<ref name="Boolean operations">{{Cite web|url=http://www.kerryr.net/pioneers/boolean.htm|title=What's So Logical About Boolean Algebra?|website=www.kerryr.net}}</ref> 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.<ref name="Claude Shannon">{{Cite web|url=http://www.kerryr.net/pioneers/shannon.htm|title=Claude Shannon (1916 - 2001)|website=www.kerryr.net}}</ref>
 
===BrailleTimeline===
==Other forms of binary code==
* 1875: [[Émile Baudot]] "Addition of binary strings in his ciphering system," which, eventually, led to the ASCII of today.
{{Main|List of binary codes}}
* 1884: The [[Linotype machine]] where the matrices are sorted to their corresponding channels after use by a binary-coded slide rail.
* 1932: [[C. E. Wynn-Williams]] "Scale of Two" counter<ref name="Glaser">{{Harvnb|Glaser|1971}}</ref>
* 1937: [[Alan Turing]] electro-mechanical binary multiplier
* 1937: [[George Stibitz]] [[Excess three code|"excess three" code]] in the [[George Stibitz#Computer|Complex Computer]]<ref name="Glaser"/>
* 1937: [[Atanasoff–Berry Computer]]<ref name="Glaser"/>
* 1938: [[Konrad Zuse]] [[Z1 (computer)|Z1]]
 
==Rendering==
{{original research|section|date=March 2015}}
[[File:Bagua-name-earlier.svg|thumb|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.
The bit string is not the only type of binary code: in fact, a binary system in general, is any system that allows only two choices such as a switch in an electronic system or a simple true or false test.
 
; Braille: [[Braille]] is a type of binary code that is widely used byto enable the blind to read and write by touch, named for its creator, Louis Braille. ThisThe system consists of grids of six dots each, three per column, in which each dot hasis two states:either raised or flat (not raised). The different combinations of raised and flattenedflat dots areencode capableinformation ofsuch representing allas letters, numbers, and punctuation signs.
===Braille===
[[Braille]] is a type of binary code that is widely used by the blind to read and write by touch, named for its creator, Louis Braille. This system consists of grids of six dots each, three per column, in which each dot has two states: raised or not raised. The different combinations of raised and flattened dots are capable of representing all letters, numbers, and punctuation signs.
 
; Bagua {{anchor|BaGua}}: The ''[[bagua]]'' areis a set of diagrams used in ''[[feng shui]],'' [[Taoist]] [[cosmology]] and ''[[I Ching]]'' studies. The ''ba gua'' consists of 8 trigrams; ''bā''each meaninga 8combination and ''guà'' meaning divination figure. The same word is used for the 64 guà (hexagrams). Each figure combinesof three lines (''yáo'') that are either broken ([[Yin and yang|''yin'']]) or unbroken (''yang''). The relationships between the trigrams are represented in two arrangements, the primordial, "Earlier Heaven" or "Fuxi" ''bagua'', and the manifested, "Later Heaven", or "King Wen" ''bagua''.<ref name='wilhelm'>{{cite book |last=Wilhelm |first=Richard |author-link=Richard Wilhelm (sinologist) |others=trans. by [[Cary F. Baynes]], foreword by [[C. G. Jung]], preface to 3rd ed. by [[Hellmut Wilhelm]] (1967) |title=The I Ching or Book of Changes |publisher=Princeton University Press |year=1950 |___location=Princeton, NJ |url=https://books.google.com/books?id=bbU9AAAAIAAJ&pg=PA266 |isbn=978-0-691-09750-3 |pages=266, 269}}</ref> (See also, the [[King Wen sequence]] of the 64 hexagrams).
===Bagua {{anchor|BaGua}}===
The ''[[bagua]]'' are diagrams used in ''[[feng shui]],'' [[Taoist]] [[cosmology]] and ''[[I Ching]]'' studies. The ''ba gua'' consists of 8 trigrams; ''bā'' meaning 8 and ''guà'' meaning divination figure. The same word is used for the 64 guà (hexagrams). Each figure combines three lines (''yáo'') that are either broken ([[Yin and yang|''yin'']]) or unbroken (''yang''). The relationships between the trigrams are represented in two arrangements, the primordial, "Earlier Heaven" or "Fuxi" ''bagua'', and the manifested, "Later Heaven", or "King Wen" ''bagua''.<ref name='wilhelm'>{{cite book |last=Wilhelm |first=Richard |author-link=Richard Wilhelm (sinologist) |others=trans. by [[Cary F. Baynes]], foreword by [[C. G. Jung]], preface to 3rd ed. by [[Hellmut Wilhelm]] (1967) |title=The I Ching or Book of Changes |publisher=Princeton University Press |year=1950 |___location=Princeton, NJ |url=https://books.google.com/books?id=bbU9AAAAIAAJ&pg=PA266 |isbn=978-0-691-09750-3 |pages=266, 269}}</ref> (See also, the [[King Wen sequence]] of the 64 hexagrams).
 
; Ifá{{anchor|Ifá}}: The [[Ifá]]/Ifé system of divination in African religions, such as of [[Yoruba people |Yoruba]], [[Igbo people |Igbo]], and [[Ewe people |Ewe]], consists of an elaborate traditional ceremony producing 256 oracles made up by 16 symbols with 256 = 16 x 16. An initiatedA priest, or [[Babalawo]], who had memorized oracles, would requestrequests sacrifice from consulting clients and makemakes prayers. Then, divination [[nut (fruit)|nuts]] or a pair of chains[[chain]]s are used to produce random binary numbers,<ref>{{Cite book |last=Olupona |first=Jacob K. |title=African Religions: A Very Short Introduction |publisher=[[Oxford University Press]] |year=2014 |isbn=978-0-19-979058-6 |___location=Oxford |pages=45 |oclc=839396781}}</ref> which are drawn with sandy material on an "Opun" figured wooden tray representing the totality of fate.<ref>{{Cite web|last=Eglash|first=Ron|date=June 2007|title=The fractals at the heart of African designs|url=https://www.ted.com/talks/ron_eglash_the_fractals_at_the_heart_of_african_designs/up-next#t-13472|url-status=live|access-date=2021-04-15|website=www.ted.com|archive-url=https://web.archive.org/web/20210727161435/https://www.ted.com/talks/ron_eglash_the_fractals_at_the_heart_of_african_designs/up-next |archive-date=2021-07-27 }}</ref>
===Ifá, Ilm Al-Raml and Geomancy{{anchor|Ifá}}===
The [[Ifá]]/Ifé system of divination in African religions, such as of [[Yoruba people|Yoruba]], [[Igbo people|Igbo]], and [[Ewe people|Ewe]], consists of an elaborate traditional ceremony producing 256 oracles made up by 16 symbols with 256 = 16 x 16. An initiated priest, or [[Babalawo]], who had memorized oracles, would request sacrifice from consulting clients and make prayers. Then, divination nuts or a pair of chains are used to produce random binary numbers,<ref>{{Cite book |last=Olupona |first=Jacob K. |title=African Religions: A Very Short Introduction |publisher=[[Oxford University Press]] |year=2014 |isbn=978-0-19-979058-6 |___location=Oxford |pages=45 |oclc=839396781}}</ref> which are drawn with sandy material on an "Opun" figured wooden tray representing the totality of fate.
 
==Encoding==
Through the spread of [[Islamic]] culture, Ifé/Ifá was assimilated as the "Science of Sand" (ilm al-raml), which then spread further and became "Science of Reading the Signs on the Ground" ([[Geomancy]]) in Europe.
 
This was thought to be another possible route from which computer science was inspired,<ref>{{Cite web|last=Eglash|first=Ron|date=June 2007|title=The fractals at the heart of African designs|url=https://www.ted.com/talks/ron_eglash_the_fractals_at_the_heart_of_african_designs/up-next#t-13472|url-status=live|access-date=2021-04-15|website=www.ted.com|archive-url=https://web.archive.org/web/20210727161435/https://www.ted.com/talks/ron_eglash_the_fractals_at_the_heart_of_african_designs/up-next |archive-date=2021-07-27 }}</ref> as Geomancy arrived at Europe at an earlier stage (about 12th Century, described by [[Hugo of Santalla|Hugh of Santalla]]) than [[I Ching]] (17th Century, described by [[Gottfried Wilhelm Leibniz]]).
 
==Coding systems==
[[File:2D Binary Index.svg|thumb|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 character |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 <code>1100001</code>.
===ASCII code===
The [[American Standard Code for Information Interchange]] (ASCII), uses a 7-bit binary code to represent text and other characters within computers, communications equipment, and other devices. Each letter or symbol is assigned a number from 0 to 127. For example, lowercase "a" is represented by <code>1100001</code> as a bit string (which is decimal 97).
 
===Binary-coded decimal===
[[Binary-coded decimal]] (BCD) is a binary encoded representation of integer values that uses a 4-bit [[nibble]] to encode decimal digits. Four binary bits can encode up to 16 distinct values; but, in BCD-encoded numbers, only ten values in each nibble are legal, and encode the decimal digits zero, through nine. The remaining six values are illegal and may cause either a machine exception or unspecified behavior, depending on the computer implementation of BCD arithmetic.
 
BCD arithmetic is sometimes preferred to floating-point numeric formats in commercial and financial applications where the complex rounding behaviors of floating-point numbers is inappropriate.<ref name="Cowlishaw_GDA">{{cite web |first=Mike F. |last=Cowlishaw |author-link=Mike F. Cowlishaw |title=General Decimal Arithmetic |orig-year=1981, 2008 |publisher=IBM |date=2015 |url=http://speleotrove.com/decimal/<!-- http://www2.hursley.ibm.com/decimal/ --> |access-date=2016-01-02}}</ref>
 
==Early uses of binary codes==
* 1875: [[Émile Baudot]] "Addition of binary strings in his ciphering system," which, eventually, led to the ASCII of today.
* 1884: The [[Linotype machine]] where the matrices are sorted to their corresponding channels after use by a binary-coded slide rail.
* 1932: [[C. E. Wynn-Williams]] "Scale of Two" counter<ref name="Glaser">{{Harvnb|Glaser|1971}}</ref>
* 1937: [[Alan Turing]] electro-mechanical binary multiplier
* 1937: [[George Stibitz]] [[Excess three code|"excess three" code]] in the [[George Stibitz#Computer|Complex Computer]]<ref name="Glaser"/>
* 1937: [[Atanasoff–Berry Computer]]<ref name="Glaser"/>
* 1938: [[Konrad Zuse]] [[Z1 (computer)|Z1]]
 
==Current uses of binary==
Most modern computers use binary encoding for instructions and data. [[CD]]s, [[DVD]]s, and [[Blu-ray Disc]]s represent sound and video digitally in binary form. Telephone calls are carried digitally on long-distance and mobile phone networks using [[pulse-code modulation]], and on [[voice over IP]] networks.
 
BCD; arithmeticBinary-coded decimal: [[Binary-coded decimal]] (BCD) is sometimesan preferredencoding toof integer values that consists of a floating4-pointbit numeric[[nibble]] formatsfor ineach commercialdecimal anddigit. financialAs applicationsa wheredecimal thedigit complexis roundingonly behaviors1 of floating-point10 numbersvalues (0 to 9) but 4 bits can encode up to 16 values, and BCD element is inappropriateinvalid for a value greater than 9.<ref name="Cowlishaw_GDA">{{cite web |first=Mike F. |last=Cowlishaw |author-link=Mike F. Cowlishaw |title=General Decimal Arithmetic |orig-year=1981, 2008 |publisher=IBM |date=2015 |url=http://speleotrove.com/decimal/<!-- http://www2.hursley.ibm.com/decimal/ --> |access-date=2016-01-02}}</ref>
==Weight of binary codes==
The weight of a binary code, as defined in the table of [[constant-weight code]]s,<ref>[http://www.research.att.com/~njas/codes/Andw/ Table of Constant Weight Binary Codes]</ref> is the [[Hamming weight]] of the binary words coding for the represented words or sequences.
 
==See also==
* [[{{Annotated link |Binary number]]file}}
* {{Annotated link |Bit array}}
* [[List of binary codes]]
* {{Annotated link |Constant-weight code}}
* [[Binary file]]
* {{Annotated link |Gray code}}
* [[Unicode]]
* {{MainAnnotated link |List of binary codes}}
* [[Gray code]]
* {{Annotated link |Unicode}}
 
==References==