Content deleted Content added
Ex.function (talk | contribs) m →BCD in electronics: Marked section as multiple issues |
Citation bot (talk | contribs) Removed URL that duplicated identifier. Removed parameters. | Use this bot. Report bugs. | Suggested by Headbomb | Linked from Wikipedia:WikiProject_Academic_Journals/Journals_cited_by_Wikipedia/Sandbox | #UCB_webform_linked 279/1032 |
||
(310 intermediate revisions by 96 users not shown) | |||
Line 1:
{{Short description|System of digitally encoding numbers}}
{{redirect|BCD code|BCD character sets|BCD (character encoding)||}}
{{Use dmy dates|date=May 2019|cs1-dates=y}}
{{Use list-defined references|date=January 2022}}
{{anchor|Compressed}}<!-- parked anchor for redirects -->
[[File:Binary clock.svg|250px|thumbnail|right|A [[binary clock]] might use [[Light-emitting diode|LED]]s to express binary values. In this clock, each column of LEDs shows a binary-coded decimal numeral of the traditional [[sexagesimal]] time.]]
In [[computing]] and [[electronics|electronic]] systems, '''binary-coded decimal''' ('''BCD''') is a class of [[Binary
In [[byte]]-oriented systems (i.e. most modern computers), the term ''unpacked'' BCD<ref name="Intel_IA32"/> usually implies a full
{{anchor|Pseudo-tetrade}}The ten states representing a BCD digit are sometimes called ''[[tetrade (computing)|tetrade]]s''<ref name="Klar_1970"/><ref name="Klar_1989"/> (the [[nibble]] typically needed to hold them is also known as a tetrade) while the unused, [[don't care]]-states are named ''pseudo-tetrad(e)s''{{small|{{bracket|[[:de:Pseudotetrade|de]]}}}},<ref name="Schneider_1986"/><ref name="Tafel_1971"/><ref name="Steinbuch-Weber-Heinemann_1974"/><ref name="Tietze-Schenk_2013"/><ref name="Kowalski_1070"/> ''pseudo-decimals'',<ref name="Klar_1989"/> or ''pseudo-decimal digits''.<ref name="Ferretti_2013"/><ref name="Speiser_1965"/><ref group="nb" name="Pseudo-tetrades"/>
BCD's main virtue, in comparison to binary [[positional system]]s, is its more accurate representation and rounding of decimal quantities, as well as its ease of conversion into conventional<!-- many among us can read hexidecimal just fine, though we don't ordinarily memorize the hexadecimal times table --> human-readable representations. Its principal drawbacks are a slight increase in the complexity of the circuits needed to implement basic arithmetic as well as slightly less dense storage.
BCD was used in many early [[decimal computer]]s, and is implemented in the instruction set of machines such as the [[IBM System/360]] series and its descendants, [[Digital Equipment Corporation]]'s [[VAX]], the [[Burroughs B1700]], and the Motorola [[68000]]-series processors.
BCD ''per se'' is not as widely used as in the past, and is unavailable or limited in newer instruction sets (e.g., [[ARM architecture family|ARM]]; [[x86]] in [[long mode]]). However, decimal [[Fixed-point arithmetic|fixed-point]] and decimal [[floating-point]] formats are still important and continue to be used in financial, commercial, and industrial computing, where the subtle conversion and fractional [[round-off error|rounding errors]] that are inherent in binary floating point formats cannot be tolerated.<ref name="Cowlishaw_GDA" />
=={{anchor|Unpacked BCD|NBCD|8421|8-4-2-1}}Background==
BCD takes advantage of the fact that any one decimal numeral can be represented by a four-bit pattern. An obvious way of encoding digits is ''Natural BCD'' (NBCD), where each decimal digit is represented by its corresponding four-bit binary value, as shown in the following table. This is also called "8421" encoding.
{| class="wikitable" style="text-align:center;"
|-
Line 41 ⟶ 49:
|}
{| class="wikitable" style="text-align:center;"
|+ 4-bit BCD codes and pseudo-tetrades
! Bit !! Weight !! style="background:lightgray"| 0 !! style="background:lightgray"| 1 !! style="background:lightgray"| 2 !! style="background:lightgray"| 3 !! style="background:lightgray"| 4 !! style="background:lightgray"| 5 !! style="background:lightgray"| 6 !! style="background:lightgray"| 7 !! style="background:lightgray"| 8 !! style="background:lightgray"| 9 !! style="background:lightgray"|10 !! style="background:lightgray"|11 !! style="background:lightgray"|12 !! style="background:lightgray"|13 !! style="background:lightgray"|14 !! style="background:lightgray"|15 !! Comment
|-
| 4 || style="background:lightgray"|8 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || rowspan="4"|'''Binary'''
|-
| 3 || style="background:lightgray"|4 || 0 || 0 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || 0 || 0 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1 || style="background:#0FF"|1
|-
| 2 || style="background:lightgray"|2 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1 || 0 || 0 || style="background:#0FF"|1 || style="background:#0FF"|1
|-
| 1 || style="background:lightgray"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1 || 0 || style="background:#0FF"|1
|-
| colspan="19"|
|-
| colspan="2"|'''Name''' || style="background:lightgray"|0 || style="background:lightgray"|1 || style="background:lightgray"|2 || style="background:lightgray"|3 || style="background:lightgray"|4 || style="background:lightgray"|5 || style="background:lightgray"|6 || style="background:lightgray"|7 || style="background:lightgray"|8 || style="background:lightgray"|9 || style="background:lightgray"|10 || style="background:lightgray"|11 || style="background:lightgray"|12 || style="background:lightgray"|13 || style="background:lightgray"|14 || style="background:lightgray"|15 || '''Decimal'''
|-
| colspan="19"|
|-
| colspan="2"|'''8 4 2 1 (XS-0)''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"|10 || style="background:gray"|11 || style="background:gray"|12 || style="background:gray"|13 || style="background:gray"|14 || style="background:gray"|15 || <!-- <ref name="Kautz_1954"/> --><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Kämmerer_1969"/><ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref group="nb" name="Non-BCD"/>
|-
| colspan="19"|
|-
| {{anchor|7421}}colspan="2"|'''7 4 2 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:gray"| || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || <ref name="Kautz_1954"/><ref name="Chinal_1973"/><ref name="MIL_1991"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Aiken code|Aiken]] (2 4 2 1)}}''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || <!-- <ref name="Kautz_1954"/> --><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Kämmerer_1969"/><ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref group="nb" name="Aiken_2421"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Excess-3 code|Excess-3]] (XS-3)}}''' || style="background:gray"|-3 || style="background:gray"|-2 || style="background:gray"|-1 || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"|10 || style="background:gray"|11 || style="background:gray"|12 || <!-- <ref name="Kautz_1954"/> --><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Kämmerer_1969"/><ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref group="nb" name="Non-BCD"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Excess-6 code|Excess-6]] (XS-6)}}''' || style="background:gray"|-6 || style="background:gray"|-5 || style="background:gray"|-4 || style="background:gray"|-3 || style="background:gray"|-2 || style="background:gray"|-1 || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="Kautz_1954"/><ref group="nb" name="Non-BCD"/>
|-
| colspan="19"|
|-
| {{anchor|Jump-at-2}}colspan="2"|'''Jump-at-2 (<!-- special -->2 4 2 1)''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|Jump-at-2}}colspan="2"|{{nowrap|'''Jump-at-8 (<!-- unsymmetrical -->2 4 2 1)'''}} || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="Stopper_1960"/><ref name="Borucki-Dittmann_1971"/><ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref group="nb" name="Unsymmetrical_2421"/>
|-
| colspan="19"|
|-
| {{anchor|4221}}colspan="2"|{{nowrap|'''4 2 2 1 (I)'''}} || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|4221 II}}colspan="2"|{{nowrap|'''4 2 2 1 (II)'''}} || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="Stopper_1960"/><ref name="Borucki-Dittmann_1971"/>
|-
| colspan="19"|
|-
| {{anchor|5421}}colspan="2"|'''5 4 2 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || style="background:gray"| || <ref name="Kautz_1954"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|5221}}colspan="2"|'''5 2 2 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || <ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|5121}}colspan="2"|'''5 1 2 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || <ref name="Chinal_1973"/>
|-
| colspan="19"|
|-
| {{anchor|5311}}colspan="2"|'''5 3 1 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:gray"| || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || <ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|White}}colspan="2"|'''{{nowrap|White (5 2 1 1)}}''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|2 || style="background:gray"| || style="background:#0FF"|3 || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:gray"| || style="background:#0FF"|7 || style="background:gray"| || style="background:#0FF"|8 || style="background:gray"| || style="background:#0FF"|9 || <ref name="White_1953"/><ref name="Kautz_1954"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|5211}}colspan="2"|'''5 2 1 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|2 || style="background:gray"| || style="background:#0FF"|3 || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:gray"| || style="background:#0FF"|6 || style="background:gray"| || style="background:#0FF"|7 || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="EHub_2015"/>
|-
| colspan="19"|
|-
| colspan="2"| || style="background:lightgray"|0 || style="background:lightgray"|1 || style="background:lightgray"|2 || style="background:lightgray"|3 || style="background:lightgray"|4 || style="background:lightgray"|5 || style="background:lightgray"|6 || style="background:lightgray"|7 || style="background:lightgray"|8 || style="background:lightgray"|9 || style="background:lightgray"|10 || style="background:lightgray"|11 || style="background:lightgray"|12 || style="background:lightgray"|13 || style="background:lightgray"|14 || style="background:lightgray"|15 ||
|-
| colspan="19"|
|-
| {{anchor|Tape}}colspan="2"|'''Magnetic tape''' || style="background:gray"| || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:#0FF"|0 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || <ref name="Kämmerer_1969"/>
|-
| colspan="19"|
|-
| {{anchor|Paul}}colspan="2"|'''Paul''' || style="background:gray"| || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|5 || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|0 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || <ref name="Paul_1995"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Gray BCD code|Gray]]}}''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|6 || style="background:#0FF" |7 || style="background:#0FF" |5 || style="background:#0FF" |4 || style="background:gray" |15 || style="background:gray"|14 || style="background:gray"|12 || style="background:gray"|13 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"|11 || style="background:gray"|10 || <ref name="Gray_1947"/><!-- <ref name="Kautz_1954"/> --><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Kämmerer_1969"/><ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref group="nb" name="Non-BCD"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Glixon code|Glixon]]}}''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:#0FF"|5 || style="background:#0FF"|4 || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:gray"| || style="background:gray"| || style="background:gray"| || <ref name="Glixon_1957"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Kämmerer_1969"/><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|Ledley}}colspan="2"|'''Ledley''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF|3 || style="background:#0FF"|2 || style="background:#0FF"|7 || style="background:#0FF"|6 || style="background:#0FF"|4 || style="background:#0FF"|5 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || <ref name="Ledley_1960"/>
|-
| colspan="19"|
|-
| {{anchor|4311}}colspan="2"|'''4 3 1 1''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|9 || <ref name="Chinal_1973"/>
|-
| colspan="19"|
|-
| {{anchor|LARC}}colspan="2"|'''[[UNIVAC LARC|LARC]]''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|2 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|3 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:gray"| || style="background:#0FF"|7 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || style="background:#0FF"|8 || <ref name="Savard_2018_Decimal"/>
|-
| colspan="19"|
|-
| {{anchor|Klar}}colspan="2"|'''Klar''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|2 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|3 || style="background:#0FF"|9 || style="background:#0FF"|8 || style="background:gray"| || style="background:#0FF"|7 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|6 || <ref name="Klar_1970"/><ref name="Klar_1989"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Petherick code|Petherick]] (RAE)}}''' || style="background:gray"| || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:gray"| || style="background:#0FF"|0 || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:gray"| || style="background:#0FF"|9 || style="background:#0FF"|5 || style="background:gray"| || <ref name="Petherick_1953"/><ref name="Petherick-Hopkins_1958"/><ref group="nb" name="Petherick_RAE"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[O'Brien code I|O'Brien I]] (Watts)}}''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|9 || style="background:#0FF"|8 || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|5 || style="background:gray"| || <ref name="O'Brien_1955"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref group="nb" name="O'Brien-I_WRD"/>
|-
| colspan="19"|
|-
| {{anchor|5-cyclic}}colspan="2"|'''5-cyclic''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF|3 || style="background:#0FF"|2 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|8 || style="background:#0FF"|7 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || <ref name="Ledley_1960"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Tompkins code I|Tompkins I]]}}''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|7 || style="background:#0FF"|5 || style="background:#0FF"|6 || <ref name="Tompkins_1956"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| {{anchor|Lippel}}colspan="2"|'''Lippel''' || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|7 || style="background:#0FF"|6 || style="background:#0FF"|5 || <ref name="Lippel_1955"/><ref name="Susskind_1958"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> -->
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[O'Brien code II|O'Brien II]]}}''' || style="background:gray"| || style="background:#0FF"|0 || style="background:#0FF"|2 || style="background:#0FF"|1 || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|3 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || style="background:#0FF"|7 || style="background:#0FF"|8 || style="background:#0FF"|5 || style="background:gray"| || style="background:#0FF"|6 || style="background:gray"| || <ref name="O'Brien_1955"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Tompkins code II|Tompkins II]]}}''' || style="background:gray"| || style="background:gray"| || style="background:#0FF"|0 || style="background:#0FF"|1 || style="background:#0FF"|4 || style="background:#0FF"|3 || style="background:gray"| || style="background:#0FF"|2 || style="background:gray"| || style="background:#0FF"|7 || style="background:#0FF"|9 || style="background:#0FF"|8 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:gray"| || style="background:gray"| || <ref name="Tompkins_1956"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> --><ref name="Dokter_1973"/><ref name="Dokter_1975"/>
|-
| colspan="19"|
|-
| colspan="2"|'''{{nowrap|[[Excess-3 Gray code|Excess-3 Gray]]}}''' || style="background:gray"|-3 || style="background:gray"|-2 || style="background:#0FF"|0 || style="background:gray"|-1 || style="background:#0FF"|4 || style="background:#0FF"|3 || style="background:#0FF"|1 || style="background:#0FF"|2 || style="background:gray"|12 || style="background:gray"|11 || style="background:#0FF"|9 || style="background:gray"|10 || style="background:#0FF"|5 || style="background:#0FF"|6 || style="background:#0FF"|8 || style="background:#0FF"|7 || <ref name="Dokter_1973"/><ref name="Dokter_1975"/><ref name="MIL_1991"/><ref group="nb" name="Gray_Stibitz"/><ref group="nb" name="Non-BCD"/>
|-
| colspan="19"|
|-
| {{anchor|63−2−1}}colspan="2"|'''6 3 −2 −1 (I)''' || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|1 || style="background:#0FF"|0 || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|4 || style="background:#0FF"|8 || style="background:#0FF"|9 || style="background:gray"| || style="background:#0FF"|7 || style="background:#0FF"|6 || <ref name="Savard_2018_Decimal"/><ref name="Yuen_1977"/>
|-
| colspan="19"|
|-
| {{anchor|63−2−1 II}}colspan="2"|'''6 3 −2 −1 (II)''' || style="background:#0FF"|0 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|5 || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|9 || style="background:#0FF"|8 || style="background:#0FF"|7 || style="background:gray"| || <ref name="Savard_2018_Decimal"/><ref name="Yuen_1977"/>
|-
| colspan="19"|
|-
| {{anchor|84−2−1}}colspan="2"|'''8 4 −2 −1''' || style="background:#0FF"|0 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|1 || style="background:#0FF"|8 || style="background:#0FF"|7 || style="background:#0FF"|6 || style="background:#0FF"|5 || style="background:gray"| || style="background:gray"| || style="background:gray"| || style="background:#0FF"|9 || <ref name="Savard_2018_Decimal"/>
|-
| colspan="19"|
|-
| {{anchor|Lucal}}colspan="2"|'''[[Lucal code|Lucal]]''' || style="background:#0FF"|0 || style="background:gray"|15 || style="background:gray"|14 || style="background:#0FF"|1 || style="background:gray"|12 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:gray"|13 || style="background:#0FF"|8 || style="background:#0FF"|7 || style="background:#0FF"|6 || style="background:#0FF"|9 || style="background:#0FF"|4 || style="background:gray"|11 || style="background:gray"|10 || style="background:#0FF"|5 || <ref name="Lucal_1959"/>
|-
| colspan="19"|
|-
| {{anchor|Kautz}}colspan="2"|'''Kautz I''' || style="background:#0FF"|0 || style="background:gray"| || style="background:gray"| || style="background:#0FF"|2 || style="background:gray"| || style="background:#0FF"|5 || style="background:#0FF"|1 || style="background:#0FF"|3 || style="background:gray"| || style="background:#0FF"|7 || style="background:#0FF"|9 || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|6 || style="background:gray"| || style="background:#0FF"|4 || <ref name="Kautz_1954"/>
|-
| colspan="19"|
|-
| {{anchor|Kautz II}}colspan="2"|'''Kautz II''' || style="background:gray"| || style="background:#0FF"|9 || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|8 || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|7 || style="background:gray"| || style="background:#0FF"|0 || style="background:#0FF"|5 || style="background:gray"| || <ref name="Kautz_1954"/><ref name="Steinbuch_1962"/><!-- <ref name="Steinbuch-Wagner_1967"/><ref name="Steinbuch-Weber-Heinemann_1974"/> -->
|-
| colspan="19"|
|-
| {{anchor|Susskind}}colspan="2"|'''Susskind I''' || style="background:gray"| || style="background:#0FF"|0 || style="background:gray"| || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|4 || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|5 || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|7 || <ref name="Susskind_1958"/>
|-
| colspan="19"|
|-
| {{anchor|Susskind II}}colspan="2"|'''Susskind II''' || style="background:gray"| || style="background:#0FF"|0 || style="background:gray"| || style="background:#0FF"|1 || style="background:gray"| || style="background:#0FF"|9 || style="background:gray"| || style="background:#0FF"|8 || style="background:#0FF"|4 || style="background:gray"| || style="background:#0FF"|3 || style="background:#0FF"|2 || style="background:#0FF"|5 || style="background:gray"| || style="background:#0FF"|6 || style="background:#0FF"|7 || <ref name="Susskind_1958"/>
|-
| colspan="19"|
|-
| colspan="2"| || style="background:lightgray"|0 || style="background:lightgray"|1 || style="background:lightgray"|2 || style="background:lightgray"|3 || style="background:lightgray"|4 || style="background:lightgray"|5 || style="background:lightgray"|6 || style="background:lightgray"|7 || style="background:lightgray"|8 || style="background:lightgray"|9 || style="background:lightgray"|10 || style="background:lightgray"|11 || style="background:lightgray"|12 || style="background:lightgray"|13 || style="background:lightgray"|14 || style="background:lightgray"|15 ||
|}
The following table represents [[decimal]] digits from 0 to 9 in various BCD encoding systems. In the headers, the "<code>8{{thinsp}}4{{thinsp}}2{{thinsp}}1</code>" indicates the weight of each bit. In the fifth column ("BCD 8{{thinsp}}4{{thinsp}}−2{{thinsp}}−1"), two of the weights are negative. Both ASCII and EBCDIC character codes for the digits, which are examples of zoned BCD, are also shown.
{| class="wikitable" style="margin:auto;"
|-
! style="background:#e0e0e0;"| <br />Digit
! style="background:#e0e0e0;"| BCD<br />8{{thinsp}}4{{thinsp}}2{{thinsp}}1
! style="background:#e0e0e0;"| [[George Stibitz|Stibitz]] code or [[Excess-3]]
! style="background:#e0e0e0;"| [[Aiken-Code]] or BCD<br />2{{thinsp}}4{{thinsp}}2{{thinsp}}1
! style="background:#e0e0e0;"| BCD<br />8{{thinsp}}4{{thinsp}}−2{{thinsp}}−1
! style="background:#e0e0e0;"| {{nowrap| [[IBM 702]], }} {{nowrap| [[IBM 705]], }} {{nowrap| [[IBM 7080]], }} {{nowrap| [[IBM 1401]] }}<br /> 8{{thinsp}}4{{thinsp}}2{{thinsp}}1
! style="background:#e0e0e0;"| [[ASCII]] <br />0000 8421
! style="background:#e0e0e0;"| [[EBCDIC]] <br />0000 8421
|- style="text-align:center;"
! style="background:#f0f0f0;"|0
| 0000
| 0011
| 0000
| 0000
| 1010
| 0011 0000
| 1111 0000
|- style="text-align:center;"
! style="background:#f0f0f0;"|1
| 0001
| 0100
| 0001
| 0111
| 0001
| 0011 0001
| 1111 0001
|- style="text-align:center;"
! style="background:#f0f0f0;"|2
| 0010
| 0101
| 0010
| 0110
| 0010
| 0011 0010
| 1111 0010
|- style="text-align:center;"
! style="background:#f0f0f0;"|3
| 0011
| 0110
| 0011
| 0101
| 0011
| 0011 0011
| 1111 0011
|- style="text-align:center;"
! style="background:#f0f0f0;"|4
| 0100
| 0111
| 0100
| 0100
| 0100
| 0011 0100
| 1111 0100
|- style="text-align:center;"
! style="background:#f0f0f0;"|5
| 0101
| 1000
| 1011
| 1011
| 0101
| 0011 0101
| 1111 0101
|- style="text-align:center;"
! style="background:#f0f0f0;"|6
| 0110
| 1001
| 1100
| 1010
| 0110
| 0011 0110
| 1111 0110
|- style="text-align:center;"
! style="background:#f0f0f0;"|7
| 0111
| 1010
| 1101
| 1001
| 0111
| 0011 0111
| 1111 0111
|- style="text-align:center;"
! style="background:#f0f0f0;"|8
| 1000
| 1011
| 1110
| 1000
| 1000
| 0011 1000
| 1111 1000
|- style="text-align:center;"
! style="background:#f0f0f0;"|9
| 1001
| 1100
| 1111
| 1111
| 1001
| 0011 1001
| 1111 1001
|}
As most computers deal with data in 8-bit [[byte]]s, it is possible to use one of the following methods to encode a BCD number:
* '''Unpacked''': Each decimal digit is encoded into one byte, with four bits representing the number and the remaining bits having no significance.
* '''Packed''': Two decimal digits are encoded into a single byte, with one digit in the least significant [[nibble]] ([[Bit numbering#Most- vs least-significant bit first|bits 0 through 3]]) and the other numeral in the most significant nibble (bits 4 through 7).<ref group="nb" name="Packed_chars"/>
In packed BCD, the same number would fit into a single byte:
Decimal: 9 1
Binary : 1001 0001
Hence the numerical range for one unpacked BCD byte is zero through nine inclusive, whereas the range for one packed BCD byte is zero through ninety-nine inclusive.
To represent numbers larger than the range of a single byte any number of contiguous bytes may be used. For example, to represent the decimal number <code>'''12345'''</code> in packed BCD, using [[big-endian]] format, a program would encode as follows:
Decimal: 0 1 2 3 4 5
Binary : 0000 0001 0010 0011 0100 0101
Here, the most significant nibble of the most significant byte has been encoded as zero, so the number is stored as <code>'''012345'''</code> (but formatting routines might replace or remove leading zeros). Packed BCD is more efficient in storage usage than unpacked BCD; encoding the same number (with the leading zero) in unpacked format would consume twice the storage.
[[Logical shift|Shifting]] and [[mask (computing)|masking]] operations are used to pack or unpack a packed BCD digit. Other [[bitwise operation]]s are used to convert a numeral to its equivalent bit pattern or reverse the process.
==Packed BCD==
<!-- Section header used in redirects -->
As an example, a 4-byte value consists of 8 nibbles, wherein the upper 7 nibbles store the digits of a 7-digit decimal value, and the lowest nibble indicates the sign of the decimal integer value. Standard sign values are 1100 ([[hexadecimal|hex]] C) for positive (+) and 1101 (D) for negative (−). This convention comes from the zone field for [[EBCDIC]] characters and the [[signed overpunch]] representation.
Other allowed signs are 1010 (A) and 1110 (E) for positive and 1011 (B) for negative. IBM System/360 processors will use the 1010 (A) and 1011 (B) signs if the A bit is set in the PSW, for the ASCII-8 standard that never passed. Most implementations also provide unsigned BCD values with a sign nibble of 1111 (F).<ref name="IBM_1980_POP"/><ref name="DEC_1983_PDP11"/><ref name="DEC_1985_VAX11"/> ILE RPG uses 1111 (F) for positive and 1101 (D) for negative.<ref name="ILE-RPG"/> These match the EBCDIC zone for digits without a sign overpunch. In packed BCD, the number 127 is represented by 0001 0010 0111 1100 (127C) and −127 is represented by 0001 0010 0111 1101 (127D). Burroughs systems used 1101 (D) for negative, and any other value is considered a positive sign value (the processors will normalize a positive sign to 1100 (C)).
{| class="wikitable" style="margin:auto; width:40%;"
|-
!
!
!
!
|- style="text-align:center;"
! style="background:#f0f0f0;"|A
Line 115 ⟶ 403:
|}
No matter how many bytes wide a [[Word (
For example, a 4-byte (32-bit) word can hold seven decimal digits plus a sign
0001 0010 0011 0100 0101 0110 0111 1101
Like character strings, the first byte of the packed decimal{{snd}} that with the most significant two digits{{snd}} is usually stored in the lowest address in memory, independent of the [[endianness]] of the machine.
Line 125 ⟶ 413:
In contrast, a 4-byte binary [[two's complement]] integer can represent values from −2,147,483,648 to +2,147,483,647.
While packed BCD does not make optimal use of storage (using about
Packed BCD is supported in the [[COBOL]] programming language as the "COMPUTATIONAL-3" (an IBM extension adopted by many other compiler vendors) or "PACKED-DECIMAL" (part of the 1985 COBOL standard) data type. It is supported in [[PL/I]] as "FIXED DECIMAL".
[[Ten's complement]] representations for negative numbers offer an alternative approach to encoding the sign of packed (and other) BCD numbers. In this case, positive numbers always have a most significant digit between 0 and 4 (inclusive), while negative numbers are represented by the 10's complement of the corresponding positive number.
As a result, this system allows for 32-bit packed BCD numbers to range from −50,000,000 to +49,999,999, and −1 is represented as 99999999. (As with ===Fixed-point packed decimal===
[[Fixed-point arithmetic|Fixed-point]] decimal numbers are supported by some programming languages (such as
For example, a packed decimal value encoded with the bytes 12 34 56 7C represents the fixed-point value +1,234.567 when the implied decimal point is located between the 12 34 56 7C
''12 34.56 7+''
The decimal point is not actually stored in memory, as the packed BCD storage format does not provide for it. Its ___location is simply known to the compiler, and the generated code acts accordingly for the various arithmetic operations.
===Higher-density encodings===
Line 142 ⟶ 434:
=={{anchor|Zoned BCD}}Zoned decimal==
Some implementations, for example [[IBM]] mainframe systems, support '''zoned decimal''' numeric representations. Each decimal digit is stored in one 8-bit<ref group=nb>6-bit for older machines.</ref> byte, with the lower four bits encoding the digit in BCD form. The upper four<ref group=nb>Two for older machines.</ref> bits, called the "zone" bits, are usually set to a fixed value so that the byte holds a character value corresponding to the digit, or to values representing plus or minus. EBCDIC<ref group=nb>The values shown for {{base|C0|16}} and {{base|D0|16}} are for code page 037.</ref> systems use a zone value of {{base|1111|2}} (
For signed zoned decimal values, the rightmost (least significant) zone nibble holds the sign digit, which is the same set of values that are used for signed packed decimal numbers (see above). Thus a zoned decimal value encoded as the hex bytes F1 F2 D3 represents the signed decimal value −123:
F1 F2 D3
===EBCDIC zoned decimal conversion table===
<!-- Note that this table should also include codes A0-A9, B0-B9, and E0-E9 for completeness. -->
{|
|-
! style="background:#e0e0e0;"|BCD
! style="background:#e0e0e0;" colspan="4"|Hexadecimal
! style="background:#e0e0e0;" colspan="4"|EBCDIC
|- style="text-align:center;
|
|
|
|
|
|
|
|
|
|- style="text-align:center;
||
||
||
||
||
||
||
|
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
||
||
||
||
||
||
|- style="text-align:center;
||
||
||
|
|
||
||
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|- style="text-align:center;
||
||
||
|
|
||
|
|
|
|}
Line 360 ⟶ 652:
===Fixed-point zoned decimal===
Some languages (such as
For example, given a six-byte signed zoned decimal value with an implied decimal point to the right of the fourth digit, the hex bytes F1 F2 F7 F9 F5 C0 represent the value +1,279.50: F1 F2 F7 F9 F5 C0
== Operations with BCD ==
=== Addition ===
It is possible to perform [[addition]] by first adding in binary, and then converting to BCD afterwards. Conversion of the simple sum of two digits can be done by adding 6 (that is, 16 − 10) when the five-bit result of adding a pair of digits has a value greater than 9. The reason for adding 6 is that there are 16 possible 4-bit BCD values (since 2<sup>4</sup> = 16), but only 10 values are valid (0000 through 1001). For example:
1001 + 1000 = 10001
9 + 8 = 17
10001 is the binary, not decimal, representation of the desired result, but the most significant 1 (the "carry") cannot fit in a 4-bit binary number. In BCD as in decimal, there cannot exist a value greater than 9 (1001) per digit. To correct this, 6 (0110) is added to the total, and then the result is treated as two nibbles:
10001 + 0110 = 00010111 => 0001 0111
17 + 6 = 23 1 7
The two nibbles of the result, 0001 and 0111, correspond to the digits "1" and "7". This yields "17" in BCD, which is the correct result.
This technique can be extended to adding multiple digits by adding in groups from right to left, propagating the second digit as a carry, always comparing the 5-bit result of each digit-pair sum to 9. Some CPUs provide a [[half-carry flag]] to facilitate BCD arithmetic adjustments following binary addition and subtraction operations. The [[Intel 8080]], the [[Zilog Z80]] and the CPUs of the x86 family provide the opcode DAA (Decimal Adjust Accumulator).
=== Subtraction ===
Subtraction is done by adding the ten's complement of the [[subtrahend]] to the [[minuend]]. To represent the sign of a number in BCD, the number 0000 is used to represent a [[positive number]], and 1001 is used to represent a [[negative number]]. The remaining 14 combinations are invalid signs. To illustrate signed BCD subtraction, consider the following problem: 357 − 432.
In signed BCD, 357 is 0000 0011 0101 0111. The ten's complement of 432 can be obtained by taking the [[nine's complement]] of 432, and then adding one. So, 999 − 432 = 567, and 567 + 1 = 568. By preceding 568 in BCD by the negative sign code, the number −432 can be represented. So, −432 in signed BCD is 1001 0101 0110 1000.
Now that both numbers are represented in signed BCD, they can be added together:
0000 0011 0101 0111
0 3 5 7
+ 1001 0101 0110 1000
9 5 6 8
= 1001 1000 1011 1111
9 8 11 15
Since BCD is a form of decimal representation, several of the digit sums above are invalid. In the event that an invalid entry (any BCD digit greater than 1001) exists, 6 is added to generate a carry bit and cause the sum to become a valid entry. So, adding 6 to the invalid entries results in the following:
1001 1000 1011 1111
9 8 11 15
+ 0000 0000 0110 0110
0 0 6 6
= 1001 1001 0010 0101
9 9 2 5
Thus the result of the subtraction is 1001 1001 0010 0101 (−925). To confirm the result, note that the first digit is 9, which means negative. This seems to be correct since 357 − 432 should result in a negative number. The remaining nibbles are BCD, so 1001 0010 0101 is 925. The ten's complement of 925 is 1000 − 925 = 75, so the calculated answer is −75.
If there are a different number of nibbles being added together (such as 1053 − 2), the number with the fewer digits must first be prefixed with zeros before taking the ten's complement or subtracting. So, with 1053 − 2, 2 would have to first be represented as 0002 in BCD, and the ten's complement of 0002 would have to be calculated.
==
===IBM===
{{Main|BCDIC}}
The
The memory of the
In the
With the introduction of [[System/360]], IBM expanded 6-bit BCD ''alphamerics'' to 8-bit
On the [[IBM 1130]] and [[IBM 1800|1800]], packed BCD is supported in software by IBM's Commercial Subroutine Package.
Today, BCD data is still heavily used in IBM
=== Other computers
The
Many processors have hardware support for BCD-encoded integer arithmetic. For example, the [[6502]],<ref>{{cite web |url=http://www.masswerk.at/6502/6502_instruction_set.html |title=6502 Instruction Set |archive-url=https://web.archive.org/web/20180508053805/http://www.masswerk.at/6502/6502_instruction_set.html |archive-date=2018-05-08 |url-status=live}}</ref><ref>{{cite web |url=http://www.6502.org/tutorials/6502opcodes.html |title=NMOS 6502 Opcodes |archive-url=https://web.archive.org/web/20160114001557/http://www.6502.org/tutorials/6502opcodes.html |archive-date=2016-01-14}}</ref> the [[Motorola 68000 series]],<ref name="Motorola_m68k"/> and the [[x86]] series.<ref>{{cite book|url= http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf|title= Intel 64 and IA-32 Architectures Software Developer's Manual Volume 1: Basic Architecture|at= Section 4.7|publisher= Intel|date= March 2013|access-date= April 23, 2013|archive-date= April 2, 2013|archive-url= https://web.archive.org/web/20130402233513/http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-1-manual.pdf|url-status= live}}</ref> The [[Intel]] x86 architecture supports a [[Intel BCD opcodes|unique 18-digit (ten-byte) BCD format]] that can be loaded into and stored from the floating point registers, from where computations can be performed.<ref name="Intel_2020_V1"/>
In more recent computers such capabilities are almost always implemented in software rather than the CPU's instruction set, but BCD numeric data are still extremely common in commercial and financial applications.
<
uint32_t BCDadd(uint32_t a, uint32_t b)
{
uint32_t
t1 = a + 0x06666666;
Line 403 ⟶ 732:
return t1 - t2; // corrected BCD sum
}
</syntaxhighlight>
==
{{Multiple issues|section=true|{{More citations needed section|date=January 2018}}{{Primary sources|section|date=January 2018}}}}
BCD is common in electronic systems where a numeric value is to be displayed, especially in systems consisting solely of digital logic, and not containing a microprocessor. By employing BCD, the manipulation of numerical data for display can be greatly simplified by treating each digit as a separate single sub-circuit.
This matches much more closely the physical reality of display hardware—a designer might choose to use a series of separate identical [[seven-segment display]]s to build a metering circuit, for example. If the numeric quantity were stored and manipulated as pure binary, interfacing with such a display would require complex circuitry. Therefore, in cases where the calculations are relatively simple, working throughout with BCD can lead to an overall simpler system than converting to and from binary. Most pocket calculators do all their calculations in BCD.
The same argument applies when hardware of this type uses an embedded microcontroller or other small processor. Often, representing numbers internally in BCD format results in smaller code, since a conversion from or to binary representation can be expensive on such limited processors. For these applications, some small processors feature dedicated arithmetic modes, which assist when writing routines that manipulate BCD quantities.<ref name="IEEE_CORDIC"/><ref name="BCS_CORDIC"/>
==Comparison with pure binary==
Line 560 ⟶ 747:
<!--as an alternative number system for computing and electronics imo a comparison to the standard one is justified (plugwash)-->
=== Advantages ===
* Scaling by a power of 10 is simple.
* [[Rounding]] at a decimal digit boundary is simpler. Addition and subtraction in decimal do not require rounding.{{dubious|Rounding|date=November 2021}}
* The alignment of two decimal numbers (for example 1.3 + 27.08) is a simple, exact shift.
* Conversion to a character form or for display (e.g., to a text-based format such as [[XML]], or to drive signals for a [[seven-segment display]]) is a simple per-digit mapping, and can be done in linear ([[Big-O notation|O]](''n'')) time. Conversion from pure [[binary number|binary]] involves relatively complex logic that spans digits, and for large numbers, no linear-time conversion algorithm is known (see {{section link|Binary number|Conversion to and from other numeral systems}}).
* Many non-integral values, such as decimal 0.2, have an infinite place-value representation in binary (.001100110011...) but have a finite place-value in binary-coded decimal (0.0010). Consequently, a system based on binary-coded decimal representations of decimal fractions avoids errors representing and calculating such values. This is useful in financial calculations.
=== Disadvantages ===
* Practical existing implementations of BCD are typically slower than operations on binary representations, especially on embedded systems, due to limited processor support for native BCD operations.<ref name="Mathur_1989" />
* Some operations are more complex to implement. [[Adder (electronics)|Adder]]s require extra logic to cause them to wrap and generate a carry early. Also, 15 to 20% more circuitry is needed for BCD add compared to pure binary.{{Citation needed|date=May 2011}} Multiplication requires the use of algorithms that are somewhat more complex than shift-mask-add (a [[Binary numeral system#Multiplication|binary multiplication]], requiring binary shifts and adds or the equivalent, per-digit or group of digits is required).
* Standard BCD requires four bits per digit, roughly 20% more space than a binary encoding (the ratio of 4 bits to log<sub>2</sub>10 bits is 1.204). When packed so that three digits are encoded in ten bits, the storage overhead is greatly reduced, at the expense of an encoding that is unaligned with the 8-bit byte boundaries common on existing hardware, resulting in slower implementations on these systems.<!-- Could add: encoding or decoding is trivial in software using a table lookup, and fast using direct logic otherwise. In hardware, it requires no more than three gate delays. -->
==Representational variations==
Line 583 ⟶ 763:
===Signed variations===
Signed decimal values may be represented in several ways. The [[COBOL]] programming language, for example, supports
{| class="wikitable" style="width:95%"
|-
Line 590 ⟶ 770:
! style="background:#D0E0FF; width:20%"| Example
|-
| [[Signed number representations|Unsigned]]
| No sign [[nibble]]
| <code>F1 F2 <u>F</u>3</code>
|-
Line 611 ⟶ 791:
|}
==={{anchor|TBCD}}Telephony
[[3GPP]] developed '''TBCD''',<ref
{| class="wikitable" style="width:30%; text-align:center"
|-
! style="background:#E0E0E0; width:50%" |Decimal<br />
! style="background:#E0E0E0; width:50%" |TBCD<br />8 4 2 1
|-
! style="background:#F0F0F0" |*
Line 639 ⟶ 819:
The mentioned 3GPP document defines '''TBCD-STRING''' with swapped nibbles in each byte. Bits, octets and digits indexed from 1, bits from the right, digits and octets from the left.
<blockquote>
bits 8765 of octet ''n'' encoding digit
bits 4321 of octet ''n'' encoding digit 2(''n
</blockquote>
Meaning number <code>1234</code>, would become <code>21 43</code> in TBCD.
This format is used in modern [[mobile telephony]] to send dialed numbers, as well as [[Mobile country code|operator ID]] (the MCC/MNC tuple), [[International Mobile Equipment Identity|IMEI]], [[International mobile subscriber identity|IMSI]] (SUPI), et.c.<ref>{{cite web|url=https://www.etsi.org/deliver/etsi_ts/124500_124599/124501/16.10.00_60/ts_124501v161000p.pdf|title=Non-Access-Stratum (NAS) protocol for 5G System (5GS); Stage 3. (3GPP TS 24.501 version 16.10.0 Release 16) TS 24.501 release 16.10.0|publisher=[[ETSI]] and [[3GPP]]|access-date=February 26, 2022|archive-date=February 17, 2022|archive-url=https://web.archive.org/web/20220217231615/https://www.etsi.org/deliver/etsi_ts/124500_124599/124501/16.10.00_60/ts_124501v161000p.pdf|url-status=live}} (TS 24.501)</ref><ref>{{cite web|url=https://www.etsi.org/deliver/etsi_ts/123000_123099/123003/16.08.00_60/ts_123003v160800p.pdf|title=Digital cellular telecommunications system (Phase 2+) (GSM); Universal Mobile Telecommunications System (UMTS); LTE; 5G; Numbering, addressing and identification (3GPP TS 23.003 version 16.8.0 Release 16)|publisher=[[ETSI]] and [[3GPP]]|access-date=February 26, 2022|archive-date=February 26, 2022|archive-url=https://web.archive.org/web/20220226144220/https://www.etsi.org/deliver/etsi_ts/123000_123099/123003/16.08.00_60/ts_123003v160800p.pdf|url-status=live}} (TS 23.003)</ref>
==Alternative encodings==
Line 651 ⟶ 833:
This representation allows rapid multiplication and division, but may require shifting by a power of 10 during addition and subtraction to align the decimal points. It is appropriate for applications with a fixed number of decimal places that do not then require this adjustment—particularly financial applications where 2 or 4 digits after the decimal point are usually enough. Indeed, this is almost a form of [[fixed point arithmetic]] since the position of the [[radix point]] is implied.
The [[
==Application==
The [[BIOS]] in many [[personal computer]]s stores the date and time in BCD because the [[MC6818]] real-time clock chip used in the original [[IBM PC AT]] motherboard provided the time encoded in BCD. This form is easily converted into ASCII for display.<ref name="Units_ENS"/><ref name="MC6818"/>
The [[Atari 8-bit computers]] use a BCD format for floating point numbers. The [[MOS Technology 6502]] processor has a BCD mode for the addition and subtraction instructions. The [[Psion Organiser|Psion Organiser 1]] handheld computer's manufacturer-supplied software also uses BCD to implement floating point; later Psion models use binary exclusively.
Early models of the [[PlayStation 3]] store the date and time in BCD. This led to a worldwide outage of the console on 1 March 2010. The last two digits of the year stored as BCD [[time formatting and storage bugs|were misinterpreted]] as 16 causing an error in the unit's date, rendering most functions inoperable. This has been referred to as the [[Year 2010 problem]].
==Legal history==
In the 1972 case ''[[Gottschalk v. Benson]]'', the [[U.S. Supreme Court]] overturned a [[United States Court of Customs and Patent Appeals|lower court]]'s decision that had allowed a [[patent]] for converting BCD-encoded numbers to binary on a computer.
The decision noted that a patent "would wholly pre-empt the mathematical formula and in practical effect would be a patent on the [[algorithm]] itself".<ref name="Gottschalk-Benson_1972" /> This was a landmark judgement that determined the [[Software patents under United States patent law|patentability of software and algorithms]].
==See also==
* [[Bi-quinary coded decimal]]
* [[Binary-coded ternary]] (BCT)
* [[Binary integer decimal]] (BID)
* [[Bitmask]]
* [[Chen–Ho encoding]]
* [[Decimal computer]]
* [[Densely packed decimal]] (DPD)
* [[Double dabble]], an algorithm for converting binary numbers to BCD
* [[Year 2000 problem]]
==Notes==
{{reflist|group="nb"|refs=
<ref group="nb" name="Pseudo-tetrades">
<ref group="nb" name="Packed_chars">In a similar fashion, multiple characters were often packed into machine [[word (computer architecture)|word]]s on [[minicomputer]]s, see [[SQUOZE#Identifier name character encoding|IBM SQUOZE]] and [[DEC RADIX 50]].</ref>
<ref group="nb" name="Non-BCD">Code states (shown in black) outside the decimal range 0–9 indicate additional states of the non-BCD variant of the code. In the BCD code variant discussed here, they are pseudo-tetrades.</ref>
<ref group="nb" name="Unsymmetrical_2421">The Jump-at-8 code is also known as unsymmetrical 2 4 2 1 code.<!-- <ref name="Borucki-Dittmann_1971"/> --></ref>
<ref group="nb" name="Petherick_RAE">The [[Petherick code]] is also known as [[Royal Aircraft Establishment]] (RAE) code.</ref>
<ref group="nb" name="Aiken_2421">The [[Aiken code]] is one of several 2 4 2 1 codes. It is also known as 2* 4 2 1 code.</ref>
<ref group="nb" name="O'Brien-I_WRD">The [[O'Brien code type I]] is also known as [[Hilger & Watts|Watts]] code or Watts reflected decimal (WRD) code.</ref>
<ref group="nb" name="Gray_Stibitz">The [[Excess-3 Gray code]] is also known as [[Frank Gray (researcher)|Gray]]–[[George Robert Stibitz|Stibitz]] code.</ref>
}}
==References==
{{
<ref name="Gottschalk-Benson_1972">{{ussc |name=Gottschalk v. Benson |volume=409 |page=63 |pin=72 |date=1972}}.</ref>
<ref name="Intel_IA32">{{cite web |author=Intel |title=ia32 architecture manual |url=http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developers-manual.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developers-manual.pdf |archive-date=2022-10-09 |url-status=live |publisher=[[Intel]] |access-date=2015-07-01}}</ref>
<ref name="
<ref name="
<ref name="Steinbuch_1962">{{cite book |title=Taschenbuch der Nachrichtenverarbeitung |language=de |editor-first=Karl W. |editor-last=Steinbuch |editor-link=Karl W. Steinbuch |author-first=Erich R. |author-last=Berger |chapter=1.3.3. Die Codierung von Zahlen |date=1962 |edition=1 |publisher=[[Springer-Verlag OHG]] |___location=Karlsruhe, Germany |publication-place=Berlin / Göttingen / New York |lccn=62-14511 |pages=68–75}} (NB. The shown Kautz code ([[#Kautz II|II]]), containing all eight available binary states with an odd count of 1s, is a slight modification of the {{citeref|Kautz|1954|original Kautz|style=plain}} code ([[#Kautz|I]]), containing all eight states with an even count of 1s, so that inversion of the most-significant bits will create a [[9s complement]].)</ref>
<ref name="Steinbuch-Weber-Heinemann_1974">{{cite book |title=Taschenbuch der Informatik - Band II - Struktur und Programmierung von EDV-Systemen |language=de |editor-first1=Karl W. |editor-last1=Steinbuch |editor-link1=Karl W. Steinbuch |editor-first2=Wolfgang |editor-last2=Weber <!-- |editor-link2=:de:Wolfgang Weber (Ingenieur)? --> |editor-first3=Traute |editor-last3=Heinemann |date=1974 |orig-date=1967 |edition=3 |volume=2 |series=Taschenbuch der Nachrichtenverarbeitung |publisher=[[Springer-Verlag]] |___location=Berlin, Germany |isbn=3-540-06241-6 |lccn=73-80607}}</ref>
<ref name="Tietze-Schenk_2013">{{cite book |title=Advanced Electronic Circuits |author-first1=Ulrich |author-last1=Tietze |author-first2=Christoph |author-last2=Schenk |date=2012-12-06 |publisher=[[Springer Science & Business Media]] |isbn=978-3642812415 |id=9783642812415 |url=https://books.google.com/books?id=dYruCAAAQBAJ |access-date=2015-08-05}}</ref>
<ref name="Kowalski_1070">{{cite book |title=Nuclear Electronics |author-first=Emil |author-last=Kowalski |date=2013-03-08 |orig-date=1970 |publisher=[[Springer-Verlag]] |isbn=
<ref name="Ferretti_2013">{{cite book |title=Wörterbuch der Elektronik, Datentechnik und Telekommunikation / Dictionary of Electronics, Computing and Telecommunications: Teil 1: Deutsch-Englisch / Part 1: German-English |author-first=Vittorio |author-last=Ferretti |edition=2 |volume=1 |publisher=Springer-Verlag |date=2013-03-13 |isbn=978-3642980886 |id=9783642980886 |url=https://books.google.com/books?id=gtHzBQAAQBAJ |access-date=2015-08-05}}</ref>
<ref name="Speiser_1965">{{cite book |author-first=Ambrosius Paul |author-last=Speiser |author-link=Ambrosius Paul Speiser |___location=[[Eidgenössische Technische Hochschule Zürich|ETH Zürich]], Zürich, Switzerland |title=Digitale Rechenanlagen - Grundlagen / Schaltungstechnik / Arbeitsweise / Betriebssicherheit |language=de |trans-title=Digital computers - Basics / Circuits / Operation / Reliability |edition=2 |date=1965 |orig-date=1961 |publisher=[[Springer-Verlag]] / [[IBM]] |lccn=65-14624 |id=0978 |page=209}}</ref>
<ref name="Dokter_1973">{{cite book |title=Digital Electronics |author-first1=Folkert |author-last1=Dokter |author-first2=Jürgen |author-last2=Steinhauer |date=1973-06-18 |series=Philips Technical Library (PTL) / Macmillan Education |publisher=[[The Macmillan Press Ltd.]] / [[N. V. Philips' Gloeilampenfabrieken]] |edition=Reprint of 1st English |___location=Eindhoven, Netherlands |sbn=333-13360-9 |isbn=978-1-349-01419-4 |doi=10.1007/978-1-349-01417-0 |url=https://books.google.com/books?id=hlRdDwAAQBAJ |archive-url=https://web.archive.org/web/20200716231044/https://books.google.com/books?id=hlRdDwAAQBAJ |url-status=dead |archive-date=16 July 2020 |access-date=2020-05-11}} (270 pages) (NB. This is based on a translation of volume I of the two-volume German edition.)</ref>
<ref name="Dokter_1975">{{cite book |author-first1=Folkert |author-last1=Dokter |author-first2=Jürgen |author-last2=Steinhauer |title=Digitale Elektronik in der Meßtechnik und Datenverarbeitung: Theoretische Grundlagen und Schaltungstechnik |language=de |series=Philips Fachbücher |publisher=[[Deutsche Philips GmbH]] |___location=Hamburg, Germany |volume=I |date=1975 |orig-date=1969 |edition=improved and extended 5th |isbn=3-87145-272-6 |page=50}} (xii+327+3 pages) (NB. The German edition of volume I was published in 1969, 1971, two editions in 1972, and 1975. Volume II was published in 1970, 1972, 1973, and 1975.)</ref>
<ref name="Kämmerer_1969">{{cite book |title=Digitale Automaten – Theorie, Struktur, Technik, Programmieren |language=de |author-first=Wilhelm |author-last=Kämmerer |author-link=:de:Wilhelm Kämmerer |editor-first1=Hans |editor-last1=Frühauf |editor-link1=:de:Hans Frühauf |editor-first2=Wilhelm |editor-last2=Kämmerer |editor-first3=Kurz |editor-last3=Schröder |editor-first4=Helmut |editor-last4=Winkler |chapter=II.15. Struktur: Informationsdarstellung im Automaten |edition=1 |date=May 1969 |publisher=[[Akademie-Verlag GmbH]] |publication-place=Berlin, Germany |___location=Jena, Germany |volume=5 |id=License no. 202-100/416/69. Order no. 4666 ES 20 K 3. |series=Elektronisches Rechnen und Regeln |page=161 |url=https://books.google.com/books?id=jkcgAQAAIAAJ}} (NB. A second edition 1973 exists as well.)</ref>
<ref name="Cowlishaw_GDA">{{cite web |author-first=Mike F. |author-last=Cowlishaw |author-link=Mike F. Cowlishaw |title=General Decimal Arithmetic |orig-date=1981, 2008 |date=2015 |url=http://speleotrove.com/decimal/<!-- http://www2.hursley.ibm.com/decimal/ --> |access-date=2016-01-02}}</ref>
<ref name="Klar_1970">{{cite book |title=Digitale Rechenautomaten – Eine Einführung |language=de |trans-title=Digital Computers – An Introduction |chapter=1.5.3 Konvertierung binär verschlüsselter Dezimalzahlen |trans-chapter=1.5.3 Conversion of binary coded decimal numbers |author-first=Rainer |author-last=Klar |publisher=[[Walter de Gruyter & Co.]] / {{ill|G. J. Göschen'sche Verlagsbuchhandlung|de|G. J. Göschen'sche Verlagsbuchhandlung}} |___location=Berlin, Germany |series=Sammlung Göschen |volume=1241/1241a |date=1970-02-01 |isbn=3-11-083160-0 |id=. Archiv-Nr. 7990709. |pages=17, 21 |edition=1 |url=https://books.google.com/books?id=QnqVDwAAQBAJ&pg=PA21 |access-date=2020-04-13 |url-status=live |archive-url=https://web.archive.org/web/20200418220658/https://books.google.de/books?id=QnqVDwAAQBAJ&pg=PA21&lpg=PA21&focus=viewport&vq=tetrade&hl=de#v=onepage&q=tetrade&f=false |archive-date=2020-04-18}} (205 pages) (NB. A 2019 reprint of the first edition is available under {{ISBN|3-11002793-3|978-3-11002793-8}}. A reworked and expanded {{citeref|Klar|1989|4th edition|style=plain}} exists as well.)</ref>
<ref name="Klar_1989">{{cite book |title=Digitale Rechenautomaten – Eine Einführung in die Struktur von Computerhardware |language=de |trans-title=Digital Computers – An Introduction into the structure of computer hardware |chapter=1.4 Codes: Binär verschlüsselte Dezimalzahlen |trans-chapter=1.4 Codes: Binary coded decimal numbers |author-first=Rainer |author-last=Klar |publisher=[[Walter de Gruyter & Co.]] |___location=Berlin, Germany |series=Sammlung Göschen |volume=2050 |date=1989 |orig-date=1988-10-01 |isbn=3-11011700-2 |pages=25, 28, 38–39 |edition=4th reworked |quote-page=25<!-- footnote 5 --> |quote=[…] Die nicht erlaubten 0/1-Muster nennt man auch Pseudodezimalen. […]}} (320 pages)</ref>
<ref name="Dewar-Smosna_1990">{{cite book |title=Microprocessors - A Programmer's View |author-first1=Robert Berriedale Keith |author-last1=Dewar |author-link1=Robert Berriedale Keith Dewar |author-first2=Matthew |author-last2=Smosna |date=1990 |edition=1 |publisher=[[McGraw-Hill Publishing Company]] |___location=[[Courant Institute]], [[New York University]], New York, USA |isbn=0-07-016638-2 |lccn=89-77320 |page=14}} (xviii+462 pages)</ref>
<ref name="Savard_2018_Decimal">{{cite web |title=Decimal Representations |author-first=John J. G. |author-last=Savard |date=2018 |orig-date=2006 |work=quadibloc |url=http://www.quadibloc.com/comp/cp0203.htm |access-date=2018-07-16 |url-status=live |archive-url=https://web.archive.org/web/20180716101321/http://www.quadibloc.com/comp/cp0203.htm |archive-date=2018-07-16}}</ref>
<ref name="Yuen_1977">{{cite journal |title=A New Representation for Decimal Numbers |author-first=Chun-Kwong |author-last=Yuen |journal=[[IEEE Transactions on Computers]] |date=December 1977 |volume=C-26 |issue=12 |doi=10.1109/TC.1977.1674792 |s2cid=40879271 |pages=1286–1288 |url=https://dl.acm.org/doi/10.1109/TC.1977.1674792 |access-date=2020-08-08 |url-status=live |archive-url=https://web.archive.org/web/20200808105531/https://dl.acm.org/doi/10.1109/TC.1977.1674792 |archive-date=2020-08-08|url-access=subscription }}</ref>
<ref name="Kautz_1954">{{cite conference |title=Optimized Data Encoding for Digital Computers |chapter=IV. Examples A. Binary Codes for Decimals, n = 4 |author-last=Kautz |author-first=William H. |author-link=William H. Kautz |conference=Convention Record of the I.R.E., 1954 National Convention, Part 4 - Electronic Computers and Information Theory |publisher=[[I.R.E.]] |series=Session 19: Information Theory III - Speed and Computation |date=June 1954 |___location=Stanford Research Institute, Stanford, California, USA |pages=47–57 [49, 51–52, 57] |url=https://worldradiohistory.com/Archive-IRE/50s/IRE-1954-Part-4-Electronic-Computers-&-Information%20pdf |access-date=2020-07-03 |url-status=live |archive-url=https://web.archive.org/web/20200703180632/https://worldradiohistory.com/Archive-IRE/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information%20pdf |archive-date=2020-07-03 |quote-page=52 |quote=[…] The last column [of Table II], labeled "Best," gives the maximum fraction possible with any code—namely 0.60—half again better than any conventional code. This extremal is reached with the ten heavily-marked vertices of the graph of [[#Kautz|Fig. 4]] for n = 4, or, in fact, with any set of ten code combinations which include all eight with an even (or all eight with an odd) number of "1's." The second and third rows of Table II list the average and peak decimal change per undetected single binary error, and have been derived using the equations of Sec. II for Δ<sub>1</sub> and δ<sub>1</sub>. The confusion index for decimals using the criterion of "decimal change," is taken to be c<sub>ij</sub> = {{!}}i − j{{!}} i,j = 0, 1, … 9. Again, the "Best" arrangement possible (the same for average and peak), one of which is shown in Fig. 4, is substantially better than the conventional codes. […] Fig. 4 [[#Kautz|Minimum-confusion code for decimals]]. […] δ<sub>1</sub>=2 Δ<sub>1</sub>=15 […]}} [https://web.archive.org/web/20200703173707/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0049.pdf] [https://web.archive.org/web/20200703175038/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0050.pdf] [https://web.archive.org/web/20200703175214/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0051.pdf] [https://web.archive.org/web/20200703175243/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0052.pdf] [https://web.archive.org/web/20200703175313/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0053.pdf] [https://web.archive.org/web/20200703175344/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0054.pdf] [https://web.archive.org/web/20200703175425/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0055.pdf] [https://web.archive.org/web/20200703175459/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0056.pdf] [https://web.archive.org/web/20200703175529/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0057.pdf] [https://web.archive.org/web/20200703175606/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0058.pdf] [https://web.archive.org/web/20200703175641/https://worldradiohistory.com/hd2/IDX-Site-Technical/Engineering-General/Archive-IRE-IDX/IDX/50s/IRE-1954-Part-4-Electronic-Computers-%26-Information-OCR-Page-0059.pdf] (11 pages) (NB. Besides the combinatorial set of 4-bit BCD "minimum-confusion codes for decimals", of which the author illustrates only one explicitly (here reproduced as [[#Kautz|code I]]) in form of a 4-bit graph, the author also shows a 16-state 4-bit "binary code for analog data" in form of a code table, which, however, is not discussed here. The [[#Kautz II|code II]] shown here is a modification of code I discussed by {{citeref|Berger|1962|Berger|style=plain}}.)</ref>
<ref name="Lippel_1955">{{cite journal |title=A Decimal Code for Analog-to-Digital Conversion |author-last=Lippel |author-first=Bernhard |journal=[[IRE Transactions on Electronic Computers]] |issn=0367-9950 |volume=EC-4 |issue=4 |date=December 1955 |doi=10.1109/TEC.1955.5219487 |pages=158–159}} (2 pages)</ref>
<ref name="Stopper_1960">{{cite journal |title=Ermittlung des Codes und der logischen Schaltung einer Zähldekade |language=de |author-first=Herbert |author-last=Stopper |editor-first=Wilhelm Tolmé |editor-last=Runge |editor-link=Wilhelm Tolmé Runge |date=March 1960 |journal=Telefunken-Zeitung (TZ) - Technisch-Wissenschaftliche Mitteilungen der Telefunken GMBH |volume=33 |issue=127 |publisher=[[Telefunken]] |publication-place=Berlin, Germany |___location=Litzelstetten, Germany |pages=13–19}} (7 pages<!-- of total pages 1–80 -->)</ref>
<ref name="Borucki-Dittmann_1971">{{cite book |title=Digitale Meßtechnik: Eine Einführung |chapter=2.3 Gebräuchliche Codes in der digitalen Meßtechnik |language=de |author-first1=Lorenz |author-last1=Borucki |author-first2=Joachim |author-last2=Dittmann |date=1971 |orig-date=July 1970, 1966, Autumn 1965 |publisher=[[Springer-Verlag]] |publication-place=Berlin / Heidelberg, Germany |___location=Krefeld / Karlsruhe, Germany |edition=2 |lccn=75-131547 |isbn=3-540-05058-2<!-- this is the ISBN printed in the book --> |id={{ISBN|978-3-642-80561-5}}<!-- this is for reprints of the 2nd edition --> |doi=10.1007/978-3-642-80560-8 |pages=10–23 [12–14]}} (viii+252 pages) [https://books.google.com/books?id=NwyCBwAAQBAJ&pg=PA15 1st edition]</ref>
<ref name="Chinal_1973">{{cite book |title=Design Methods for Digital Systems |author-first=Jean P. |author-last=Chinal |chapter=Codes |language=en |publisher=[[Akademie-Verlag]] / [[Springer-Verlag]] |publication-place=Berlin, Germany |___location=Paris, France |translator-first=Alan |translator-last1=Preston |translator-first2=Arthur |translator-last2=Summer |date=January 1973 |edition=1st English |id=License No. 202-100/542/73. Order No. 7617470(6047) ES 19 B 1 / 20 K 3 |isbn=978-0-387-05871-9 |doi=10.1007/978-3-642-86187-1_3|page=46 |url=https://books.google.com/books?id=8FnxCAAAQBAJ |access-date=2020-06-21}} (xviii+506 pages) (NB. The French 1967 original book was named "Techniques Booléennes et Calculateurs Arithmétiques", published by {{ill|Éditions Dunod|fr}}.)</ref>
<ref name="Gray_1947">{{cite book |author-first=Frank |author-last=Gray |author-link=Frank Gray (researcher) |title=Pulse Code Communication |date=1953-03-17<!-- gdate --> |orig-date=1947-11-13<!-- fdate --> |publisher=[[Bell Telephone Laboratories, Incorporated]] |___location=New York, USA |id={{US patent|2632058}}. Serial No. 785697 |url=https://patentimages.storage.googleapis.com/a3/d7/f2/0343f5f2c0cf50/US2632058.pdf |access-date=2020-08-05 |url-status=live |archive-url=https://web.archive.org/web/20200805094312/https://patentimages.storage.googleapis.com/a3/d7/f2/0343f5f2c0cf50/US2632058.pdf |archive-date=2020-08-05}} (13 pages)</ref>
<ref name="Glixon_1957">{{cite journal |date=March 1957 |title=Can You Take Advantage of the Cyclic Binary-Decimal Code? |author-first=Harry Robert |author-last=Glixon |journal=[[Control Engineering (magazine)|Control Engineering]] |issn=0010-8049 |publisher=[[Technical Publishing Company]], a division of Dun-Donnelley Publishing Corporation, [[Dun & Bradstreet Corp.]] |volume=4 |number=3 |pages=<!-- 3, -->87–91 |url=https://books.google.com/books?id=-_5IAQAAIAAJ}}<!-- https://web.archive.org/web/20180115014809/https://donmooreswartales.com/2010/05/12/harry-glixon/ https://books.google.com/books?id=-_5IAQAAIAAJ&focus=searchwithinvolume&q=cyclic+binary+code --> (5 pages)</ref>
<ref name="White_1953">{{cite journal |title=Coded Decimal Number Systems for Digital Computers |author-first=Garland S. |author-last=White |journal=[[Proceedings of the Institute of Radio Engineers]] |publisher=[[Institute of Radio Engineers]] (IRE) |issn=0096-8390 |eissn=2162-6634 |volume=41 |number=10 |date=October 1953 |doi=10.1109/JRPROC.1953.274330 |s2cid=51674710 |pages=1450–1452}} (3 pages)</ref>
<ref name="Lucal_1959">{{cite journal |author-first=Harold M. |author-last=Lucal |title=Arithmetic Operations for Digital Computers Using a Modified Reflected Binary |journal=[[IRE Transactions on Electronic Computers]] |volume=EC-8 |number=4 |pages=449–458 |date=December 1959 |issn=0367-9950 |doi=10.1109/TEC.1959.5222057 |s2cid=206673385 }} (10 pages)</ref>
<ref name="EHub_2015">{{cite web |title=Different Types of Binary Codes |at=Section 2.4 5211 Code |date=2019-05-01 |orig-date=2015-01-28 |work=Electronic Hub |url=https://www.electronicshub.org/disclaimer/ |access-date=2020-08-04 |url-status=live |archive-url=https://web.archive.org/web/20200518203953/https://www.electronicshub.org/disclaimer/ |archive-date=2020-05-18}}</ref>
<ref name="Paul_1995">{{cite web |author-first=Matthias R. |author-last=Paul |title=Unterbrechungsfreier Schleifencode |language=de |trans-title=Continuous loop code |version=1.02 |url=http://www.uni-bonn.de/~uzs180/download/mpbcd102.zip |date=1995-08-10 |orig-date=1994 |access-date=2008-02-11}}{{cbignore}} (NB. The author called this code {{lang|de|Schleifencode}} (English: "loop code"). It differs from [[Gray BCD code]] only in the encoding of state 0 to make it a cyclic [[unit-distance code]] for full-circle rotatory [[slip ring]] applications. Avoiding the all-zero code pattern allows for loop self-testing and to use the data lines for uninterrupted power distribution.)</ref>
<ref name="Petherick_1953">{{cite book |author-first=Edward John |author-last=Petherick |title=A Cyclic Progressive Binary-coded-decimal System of Representing Numbers |date=October 1953 |type=Technical Note MS15 |publisher=[[Royal Aircraft Establishment]] (RAE) |___location=Farnborough, UK}} (4 pages) (NB. Sometimes referred to as ''A Cyclic-Coded Binary-Coded-Decimal System of Representing Numbers''.)</ref>
<ref name="Petherick-Hopkins_1958">{{cite book |author-first1=Edward John |author-last1=Petherick |author-first2=A. J. |author-last2=Hopkins |title=Some Recently Developed Digital Devices for Encoding the Rotations of Shafts |date=1958 |type=Technical Note MS21 |publisher=[[Royal Aircraft Establishment]] (RAE) |___location=Farnborough, UK}}</ref>
<ref name="O'Brien_1955">{{cite journal |author-first=Joseph A. |author-last=O'Brien |title=Cyclic Decimal Codes for Analogue to Digital Converters |journal=[[Transactions of the American Institute of Electrical Engineers, Part I: Communication and Electronics]] |___location=Bell Telephone Laboratories, Whippany, New Jersey, USA |volume=75 |issue=2 |date=May 1956 |orig-date=1955-11-15, 1955-06-23 |issn=0097-2452 |doi=10.1109/TCE.1956.6372498 |id=Paper 56-21 |s2cid=51657314 |pages=120–122 |url=https://pdfslide.net/documents/cyclic-decimal-codes-for-analogue-to-digital-converters.html |access-date=2020-05-18 |archive-date=2020-05-18 |archive-url=https://web.archive.org/web/20200518075301/https://pdfslide.net/documents/cyclic-decimal-codes-for-analogue-to-digital-converters.html |url-status=dead }} (3 pages) (NB. This paper was prepared for presentation at the AIEE Winter General Meeting, New York, USA, 1956-01-30 to 1956-02-03.)</ref>
<ref name="Tompkins_1956">{{cite journal |author-first=Howard E. |author-last=Tompkins |title=Unit-Distance Binary-Decimal Codes for Two-Track Commutation |date=September 1956 |orig-date=1956-07-16 |journal=[[IRE Transactions on Electronic Computers]] |issn=0367-9950 |volume=EC-5 |issue=3 |doi=10.1109/TEC.1956.5219934 |series=Correspondence |___location=[[Moore School of Electrical Engineering]], [[University of Pennsylvania]], Philadelphia, Pennsylvania, USA |page=139 |url=https://dokumen.tips/documents/unit-distance-binary-decimal-codes-for-two-track-commutation.html |access-date=2020-05-18 |archive-date=2020-05-18 |archive-url=https://web.archive.org/web/20200518083051/https://dokumen.tips/documents/unit-distance-binary-decimal-codes-for-two-track-commutation.html |url-status=dead }} (1 page)</ref>
<ref name="Susskind_1958">{{cite book |title=Notes on Analog-Digital Conversion Techniques |chapter=III.F. Unit-Distance Codes / VI.E.2. Reflected Binary Codes |editor-first=Alfred Kriss |editor-last=Susskind<!-- born 1923-10-04, Coblenz (Göda), Germany, died 1988-12-10 Bethesda, Maryland, USA --> |author-first1=Alfred Kriss<!-- Patent US3487460A erroneously refers to Alfred Kriss Susskind as Alfred N. Susskind: https://patents.google.com/patent/US3487460A --> |author-last1=Susskind |author-first2=John Erwin |author-last2=Ward<!-- born 1920 --> |date=1958-03-28 |orig-date=1957, 1956 |edition=3 |publisher=[[Technology Press of the Massachusetts Institute of Technology]] / [[John Wiley & Sons, Inc.]] / [[Chapman & Hall, Ltd.]] |publication-place=New York, USA |___location=Cambridge, Massachusetts, USA |series=Technology Books in Science and Engineering |volume=1 |pages=3-7–3-8 [3-7], 3-10–3-16 [3-13–3-16], 6-65–6-60 [6-60]}} (x+416+2 pages) (NB. The contents of the book was originally prepared by staff members of the [[MIT Servomechanisms Laboratory|Servomechanisms Laboraratory]], Department of Electrical Engineering, [[Massachusetts Institute of Technology|MIT]], for Special Summer Programs held in 1956 and 1957. The code Susskind actually presented in his work as "reading-type code" is shown as code type II here, whereas the type I code<!-- which is not directly discussed in the book --> is a minor derivation with the two most significant bit columns swapped to better illustrate symmetries.)</ref>
<ref name="MIL_1991">{{cite book |title=Military Handbook: Encoders - Shaft Angle To Digital |publisher=[[United States Department of Defense]] |id=MIL-HDBK-231A |date=1991-09-30 |url=http://everyspec.com/MIL-HDBK/MIL-HDBK-0200-0299/download.php?spec=MIL_HDBK_231A.1809.pdf |access-date=2020-07-25 |url-status=live |archive-url=https://web.archive.org/web/20200725051128/http://everyspec.com/MIL-HDBK/MIL-HDBK-0200-0299/download.php?spec=MIL_HDBK_231A.1809.pdf |archive-date=2020-07-25}} (NB. Supersedes MIL-HDBK-231(AS) (1970-07-01).)</ref>
<ref name="Lala_2007">{{cite book |author-first=Parag K. |author-last=Lala |title=Principles of Modern Digital Design |date=2007 |publisher=[[John Wiley & Sons]] |isbn=978-0-470-07296-7 |pages=20–25 |url=https://books.google.com/books?id=doNGOrHUyCoC&pg=PA20}}</ref>
<ref name="IBM_1980_POP">{{cite book |title=IBM System/370 Principles of Operation |chapter=Chapter 8: Decimal Instructions |publisher=[[IBM]] |date=March 1980}}</ref>
<ref name="DEC_1983_PDP11">{{cite book |title=PDP-11 Architecture Handbook |chapter=Chapter 3: Data Representation |publisher=[[Digital Equipment Corporation]] |date=1983}}</ref>
<ref name="DEC_1985_VAX11">{{cite book |title=VAX-11 Architecture Handbook |publisher=[[Digital Equipment Corporation]] |date=1985}}</ref>
<ref name="ILE-RPG">{{cite web |url=http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c0925083170.htm |title=ILE RPG Reference}}</ref>
<ref name="Van1401">{{cite web |url=https://ibm-1401.info/Van1401-CodeChart.pdf |title=IBM 1401/1440/1460/1410/7010 Character Code Chart in BCD Order}}</ref>
<ref name="Intel_2020_V1">{{cite book |title=Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1: Basic Architecture |chapter=4.7 BCD and packed BCD integers |volume=1 |version=Version 072 |pages=3-2, 4-9–4-11 [4-10] |date=2020-05-27 |orig-date=1997 |id=253665-072US |publisher=[[Intel Corporation]] |url=https://software.intel.com/content/dam/develop/public/us/en/documents/253665-sdm-vol-1.pdf |access-date=2020-08-06 |url-status=live |archive-url=https://web.archive.org/web/20200806110842/https://software.intel.com/content/dam/develop/public/us/en/documents/253665-sdm-vol-1.pdf |archive-date=2020-08-06 |quote-page=4-10 |quote=[…] When operating on BCD integers in [[general-purpose register]]s, the BCD values can be unpacked (one BCD digit per byte) or packed (two BCD digits per byte). The value of an unpacked BCD integer is the binary value of the low [[Nibble|halfbyte]] (bits 0 through 3). The high half-byte (bits 4 through 7) can be any value during addition and subtraction, but must be zero during multiplication and division. Packed BCD integers allow two BCD digits to be contained in one byte. Here, the digit in the high half-byte is more significant than the digit in the low half-byte. […] When operating on BCD integers in [[x87]] [[floating-point unit|FPU]] data registers, BCD values are packed in an 80-bit format and referred to as decimal integers. In this format, the first 9 bytes hold 18 BCD digits, 2 digits per byte. The [[least-significant digit]] is contained in the lower half-byte of byte 0 and the [[most-significant digit]] is contained in the upper half-byte of byte 9. The most significant bit of byte 10 contains the [[sign bit]] (0 = positive and 1 = negative; bits 0 through 6 of byte 10 are [[don't-care term|don't care]] bits). Negative decimal integers are not stored in [[two's complement]] form; they are distinguished from positive decimal integers only by the sign bit. The range of decimal integers that can be encoded in this format is −10<sup>18</sup> + 1 to 10<sup>18</sup> − 1. The decimal integer format exists in memory only. When a decimal integer is loaded in an x87 FPU data register, it is automatically converted to the [[double-extended-precision floating-point format]]. All decimal integers are exactly representable in double extended-precision format. […]}} [http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html]</ref>
<ref name="Motorola_m68k">{{cite web |title=The 68000's Instruction Set |date= |url=http://www.tigernt.com/onlineDoc/68000.pdf |access-date=2023-11-21 |url-status=live |archive-url=https://web.archive.org/web/20231120233850/http://www.tigernt.com/onlineDoc/68000.pdf |archive-date=2023-11-20}} (58 pages)</ref>
<ref name="Jones_1999_AT">{{cite web |title=BCD Arithmetic, a tutorial |work=Arithmetic Tutorials |author-first=Douglas W. |author-last=Jones |author-link=Douglas W. Jones |publisher=The [[University of Iowa]], Department of Computer Science |orig-date=1999 |date=2015-11-25 |___location=Iowa City, Iowa, USA |url=http://homepage.cs.uiowa.edu/~jones/bcd/bcd.html |access-date=2016-01-03}}</ref>
<ref name="IEEE_CORDIC">{{cite web |author=University of Alicante |title=A Cordic-based Architecture for High Performance Decimal Calculations |url=http://rua.ua.es/dspace/bitstream/10045/11826/1/VF-016519.pdf |archive-url=https://web.archive.org/web/20100105044510/http://rua.ua.es/dspace/bitstream/10045/11826/1/VF-016519.pdf |archive-date=2010-01-05 |url-status=live |publisher=[[IEEE]] |access-date=2015-08-15}}</ref>
<ref name="BCS_CORDIC">{{cite web |title=Decimal CORDIC Rotation based on Selection by Rounding: Algorithm and Architecture |url=http://faculties.sbu.ac.ir/~jaberipur/Papers/Journals/19.pdf |archive-url=https://ghostarchive.org/archive/20221009/http://faculties.sbu.ac.ir/~jaberipur/Papers/Journals/19.pdf |archive-date=2022-10-09 |url-status=live |publisher=[[British Computer Society]] |access-date=2015-08-14}}</ref>
<ref name="Mathur_1989">{{Cite book |author-last=Mathur |author-first=Aditya P. |url=https://books.google.com/books?id=Gky_Gjk4De0C&pg=PA42 |title=Introduction to Microprocessors |edition=3 |date=1989 |publisher=[[Tata McGraw-Hill Publishing Company Limited]] |isbn=978-0-07-460222-5}}</ref>
<ref name="3GPP_2013_TS29002">{{cite tech report |title=3GPP TS 29.002: Mobile Application Part (MAP) specification |at=sec. 17.7.8 Common data types |date=2013 |url=http://www.3gpp.org/ftp/Specs/html-info/29002.htm}}</ref>
<ref name="ETSI_SPS">{{cite web |url=http://www.etsi.org/deliver/etsi_etr/001_099/060/02_60/etr_060e02p.pdf |archive-url=https://web.archive.org/web/20131204061024/http://www.etsi.org/deliver/etsi_etr/001_099/060/02_60/etr_060e02p.pdf |archive-date=2013-12-04 |url-status=live |title=Signalling Protocols and Switching (SPS) Guidelines for using Abstract Syntax Notation One (ASN.1) in telecommunication application protocols |page=15}}</ref>
<ref name="OpenSS_XMAP">{{cite web |url=http://www.openss7.org/specs/xmap.pdf |title=XOM Mobile Application Part (XMAP) Specification |page=93 |access-date=2013-06-27 |archive-url=https://web.archive.org/web/20150221103429/http://www.openss7.org/specs/xmap.pdf |archive-date=2015-02-21 |url-status=dead}}</ref>
<ref name="Units_ENS">{{cite web |title=Timer Counter Circuits in an IBM PC |issue=Week 8 |website=www.se.ecu.edu.au |url=http://www.se.ecu.edu.au/units/ens1242/lectures/ens_Notes_08.pdf |access-date=2022-05-22 |url-status=dead |archive-url=https://web.archive.org/web/20081010064411/http://www.se.ecu.edu.au/units/ens1242/lectures/ens_Notes_08.pdf |archive-date=2008-10-10}} (7 pages)</ref>
<ref name="MC6818">MC6818 datasheet</ref>
<ref name="Evans_1961">{{anchor|Ferranti}}{{cite book |title=Digital Data: Their derivation and reduction for analysis and process control |chapter=Chapter Four: Ancillary Equipment: Output-drive and parity-check relays for digitizers |author-first=David Silvester |author-last=Evans<!-- M.I.E.E. --> |edition=1<!-- printed by J. W. Arrowsmith Ltd, Bristol, UK --> |publisher=[[Hilger & Watts Ltd]] / [[Interscience Publishers]] |___location=London, UK |date=March 1961 |pages=46–64 [56–57] |url=https://books.google.com/books?id=WOIJAAAAMAAJ |access-date=2020-05-24}} (8+82 pages) (NB. The 4-bit [[#8421|8421]] BCD code with an extra [[parity bit]] applied as [[least significant bit]] to achieve [[odd parity]] of the resulting 5-bit code is also known as ''Ferranti code''.)</ref>
<ref name="Ledley_1960">{{cite book |title=Digital Computer and Control Engineering |chapter=Part 4. Logical Design of Digital-Computer Circuitry; Chapter 15. Serial Arithmetic Operations; Chapter 15-7. Additional Topics |author-first1=Robert Steven |author-last1=Ledley |author-link1=Robert Steven Ledley |author-first2=Louis S. |author-last2=Rotolo |author-first3=James Bruce |author-last3=Wilson |publisher=[[McGraw-Hill Book Company, Inc.]] (printer: The Maple Press Company, York, Pennsylvania, USA) |publication-place=New York, USA |series=McGraw-Hill Electrical and Electronic Engineering Series |edition=1 |date=1960 |sbn=07036981-X |isbn=0-07036981-X |id=. ark:/13960/t72v3b312 |issn=2574-7916 |ol=OL5776493M |lccn=59015055 |oclc=1033638267 |pages=517–518 |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/columbiaUniv/Ledley_Digital_Computer_and_Control_Engineering_1960.pdf |access-date=2021-02-19 |url-status=live |archive-url=https://web.archive.org/web/20210219203314/http://bitsavers.informatik.uni-stuttgart.de/pdf/columbiaUniv/Ledley_Digital_Computer_and_Control_Engineering_1960.pdf |archive-date=2021-02-19 |quote-page=517 |quote=[…] The cyclic code is advantageous mainly in the use of relay circuits, for then a sticky relay will not give a false state as it is delayed in going from one cyclic number to the next. There are many other cyclic codes that have this property. […]}} [https://archive.org/details/digitalcomputerc00ledl] (xxiv+835+1 pages) (NB. Ledley classified the described cyclic code as a ''cyclic decimal-coded binary code''.)</ref>
}}
==Further reading==
* {{cite book |url=https://textfiles.meulie.net/bitsaved/Books/Mackenzie_CodedCharSets.pdf |title=Coded Character Sets, History and Development |
* <!-- <ref name="Richards_1955"> -->{{cite book |author-first=Richard Kohler |author-last=Richards |title=Arithmetic Operations in Digital Computers |publisher=[[van Nostrand (publisher)|van Nostrand]] |___location=New York, USA |date=1955 |pages=
* {{cite book |title=Decimal Computation |author-first=Hermann |author-last=Schmid<!-- General Electric Company, Binghamton, New York, USA --> |author-link=Hermann Schmid (computer scientist) |date=1974 |edition=1 |publisher=[[John Wiley & Sons]] |___location=Binghamton, New York, USA |isbn=0-471-76180-X |url-access=registration |url=https://archive.org/details/decimalcomputati0000schm}} and {{cite book |title=Decimal Computation |author-first=Hermann |author-last=Schmid<!-- General Electric Company, Binghamton, New York, USA --> |author-link=Hermann Schmid (computer scientist) |orig-
* <!-- <ref name="Massalin_1987_Superoptimizer"> -->{{cite journal |author-first=Henry |author-last=Massalin
**{{cite web |title=GNU Superoptimizer |website=HP-UX |url=http://hpux.connect.org.uk/hppd/hpux/Gnu/superopt-2.5/readme.html}}
* {{cite conference |title=VLSI designs for redundant binary-coded decimal addition |author-first1=Behrooz |author-last1=Shirazi |author-first2=David Y. Y. |author-last2=Yun |author-first3=Chang N. |author-last3=Zhang |conference=IEEE Seventh Annual International Phoenix Conference on Computers and Communications, 1988 |pages=52–56 |publisher=[[IEEE]] |date=March 1988}}
* {{cite book |title=Fundamentals of Digital Logic |date=2003 |author-last1=Brown |author-last2=Vranesic}}
* {{cite conference |title=Modified Carry Look Ahead BCD Adder With CMOS and Reversible Logic Implementation |author-first1=Himanshu |author-last1=Thapliyal |author-first2=Hamid R. |author-last2=Arabnia |conference=Proceedings of the 2006 International Conference on Computer Design (CDES'06) |isbn=1-60132-009-4 |pages=64–69 |publisher=CSREA Press |date=November 2006}}
* {{cite conference |title=Reversible Implementation of {{Sic|hide=y|Densely|-}}Packed-Decimal Converter to and from Binary-Coded-Decimal Format Using in IEEE-754R |author-first1=A. |author-last1=Kaivani |author-first2=A. Zaker |author-last2=Alhosseini |author-first3=S. |author-last3=Gorgin |author-first4=M. |author-last4=Fazlali |conference=9th International Conference on Information Technology (ICIT'06) |pages=273–276 |publisher=[[IEEE]] |date=December 2006}}
* {{cite web |author-first=Mike F. |author-last=Cowlishaw |author-link=Mike F. Cowlishaw |title=Bibliography of material on Decimal Arithmetic – by category |work=General Decimal Arithmetic |orig-date=2002, 2008 |publisher=IBM |date=2009 |url=http://speleotrove.com/decimal/decbibindex.html<!-- http://www2.hursley.ibm.com/decimal/decbibindex.html --> |access-date=2016-01-02}}
==External links==
* {{cite web |author-first=Mike F. |author-last=Cowlishaw |author-link=Mike F. Cowlishaw |title=A Summary of Chen-Ho Decimal Data encoding |work=General Decimal Arithmetic |orig-
* {{cite web |author-first=Mike F. |author-last=Cowlishaw |author-link=Mike F. Cowlishaw |title=A Summary of Densely Packed Decimal encoding |work=General Decimal Arithmetic |orig-
* [http://www.unitjuggler.com/convert-numbersystems-from-decimal-to-bcd.html Convert BCD to decimal, binary and hexadecimal and vice versa]
* [https://github.com/c-rack/bcd4j BCD for Java]
Line 705 ⟶ 952:
[[Category:Non-standard positional numeral systems]]
[[Category:Binary arithmetic]]
[[Category:Articles with example C code]]
|