Abinary clock might useLEDs to express binary values. In this clock, each column of LEDs shows a binary-coded decimal numeral of the traditionalsexagesimal time.
Incomputing andelectronic systems,binary-coded decimal (BCD) is a class ofbinary encodings ofdecimal numbers where eachdigit is represented by a fixed number ofbits, usually four or eight. Sometimes, special bit patterns are used for asign or other indications (e.g. error or overflow).
Inbyte-oriented systems (i.e. most modern computers), the termunpacked BCD[1] usually implies a full byte for each digit (often including a sign), whereaspacked BCD typically encodes two digits within a single byte by taking advantage of the fact that four bits are enough to represent the range 0 to 9. The precise four-bit encoding, however, may vary for technical reasons (e.g.Excess-3).
The ten states representing a BCD digit are sometimes calledtetrades[2][3] (thenibble typically needed to hold them is also known as a tetrade) while the unused,don't care-states are namedpseudo-tetrad(e)s[de],[4][5][6][7][8]pseudo-decimals,[3] orpseudo-decimal digits.[9][10][nb 1]
BCD's main virtue, in comparison to binarypositional systems, is its more accurate representation and rounding of decimal quantities, as well as its ease of conversion into conventional 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.
BCDper se is not as widely used as in the past, and is unavailable or limited in newer instruction sets (e.g.,ARM;x86 inlong mode). However, decimalfixed-point and decimalfloating-point formats are still important and continue to be used in financial, commercial, and industrial computing, where the subtle conversion and fractionalrounding errors that are inherent in binary floating point formats cannot be tolerated.[11]
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 isNatural 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.
Decimal digit
BCD
8
4
2
1
0
0
0
0
0
1
0
0
0
1
2
0
0
1
0
3
0
0
1
1
4
0
1
0
0
5
0
1
0
1
6
0
1
1
0
7
0
1
1
1
8
1
0
0
0
9
1
0
0
1
This scheme can also be referred to asSimple Binary-Coded Decimal (SBCD) orBCD 8421, and is the most common encoding.[12] Others include the so-called "4221" and "7421" encoding – named after the weighting used for the bits – and "Excess-3".[13] For example, the BCD digit 6,0110'b in 8421 notation, is1100'b in 4221 (two encodings are possible),0110'b in 7421, while in Excess-3 it is1001'b ().
The following table representsdecimal digits from 0 to 9 in various BCD encoding systems. In the headers, the "8421" indicates the weight of each bit. In the fifth column ("BCD 84−2−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.
As most computers deal with data in 8-bitbytes, 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 significantnibble (bits 0 through 3) and the other numeral in the most significant nibble (bits 4 through 7).[nb 8]
As an example, encoding the decimal number91 using unpacked BCD results in the following binary pattern of two bytes:
Decimal: 9 1Binary : 0000 1001 0000 0001
In packed BCD, the same number would fit into a single byte:
Decimal: 9 1Binary : 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 number12345 in packed BCD, usingbig-endian format, a program would encode as follows:
Here, the most significant nibble of the most significant byte has been encoded as zero, so the number is stored as012345 (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.
Shifting andmasking operations are used to pack or unpack a packed BCD digit. Otherbitwise operations are used to convert a numeral to its equivalent bit pattern or reverse the process.
Some computers whose words are multiples of anoctet (8-bit byte), for example contemporary IBM mainframe systems, supportpacked BCD (orpacked decimal[38]) numeric representations, in which eachnibble represents either a decimal digit or a sign.[nb 8] Packed BCD has been in use since at least the 1960s and is implemented in all IBM mainframe hardware since then. Most implementations arebig endian, i.e. with the more significant digit in the upper half of each byte, and with the leftmost byte (residing at the lowest memory address) containing the most significant digits of the packed decimal value. The lower nibble of the rightmost byte is usually used as the sign flag, although some unsigned representations lack a sign flag.
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 (hex C) for positive (+) and 1101 (D) for negative (−). This convention comes from the zone field forEBCDIC characters and thesigned 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).[39][40][41] ILE RPG uses 1111 (F) for positive and 1101 (D) for negative.[42] 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)).
Sign digit
BCD 8 4 2 1
Sign
Notes
A
1 0 1 0
+
B
1 0 1 1
−
C
1 1 0 0
+
Preferred
D
1 1 0 1
−
Preferred
E
1 1 1 0
+
F
1 1 1 1
+
Unsigned
No matter how many bytes wide aword is, there is always an even number of nibbles because each byte has two of them. Therefore, a word ofn bytes can contain up to (2n)−1 decimal digits, which is always an odd number of digits. A decimal number withd digits requires1/2(d+1) bytes of storage space.
For example, a 4-byte (32-bit) word can hold seven decimal digits plus a sign and can represent values ranging from ±9,999,999. Thus the number −1,234,567 is 7 digits wide and is encoded as:
Like character strings, the first byte of the packed decimal – that with the most significant two digits – is usually stored in the lowest address in memory, independent of theendianness of the machine.
In contrast, a 4-byte binarytwo'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 20% more memory thanbinary notation to store the same numbers), conversion toASCII, EBCDIC, or the various encodings ofUnicode is made trivial, as no arithmetic operations are required. The extra storage requirements are usually offset by the need for the accuracy and compatibility with calculator or hand calculation that fixed-point decimal arithmetic provides. Denser packings ofBCD exist which avoid the storage penalty and also need no arithmetic operations for common conversions.
Packed BCD is supported in theCOBOL 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 inPL/I as "FIXED DECIMAL". Beside the IBM System/360 and later compatible mainframes, packed BCD is implemented in the native instruction set of the originalVAX processors fromDigital Equipment Corporation and some models of theSDS Sigma series mainframes, and is the native format for theBurroughs Medium Systems line of mainframes (descended from the 1950sElectrodata 200 series).
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 two's complement binary numbers, the range is not symmetric about zero.)
Fixed-point decimal numbers are supported by some programming languages (such as COBOL and PL/I). These languages allow the programmer to specify an implicit decimal point in front of one of the digits.
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 fourth and fifth digits:
12 34 56 7C12 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.
If a decimal digit requires four bits, then three decimal digits require 12 bits. However, since 210 (1,024) is greater than 103 (1,000), if three decimal digits are encoded together, only 10 bits are needed. Two such encodings areChen–Ho encoding anddensely packed decimal (DPD). The latter has the advantage that subsets of the encoding encode two digits in the optimal seven bits and one digit in four bits, as in regular BCD.
Some implementations, for exampleIBM mainframe systems, supportzoned decimal numeric representations. Each decimal digit is stored in one 8-bit[nb 9] byte, with the lower four bits encoding the digit in BCD form. The upper four[nb 10] 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[nb 11] systems use a zone value of 11112 (F16), yielding F016-F916, the codes for "0" through "9", a zone value of 11002 (C16) for positive, yielding C016-C916, the codes for "{" through "I" and a zone value of 11102 (D16) for negative, yielding D016-D916, the codes for the characters "}" through "R". Similarly, ASCII systems use a zone value of 0011 (hex 3), giving character codes 30 to 39 (hex).
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:
Some languages (such as COBOL and PL/I) directly support fixed-point zoned decimal values, assigning an implicit decimal point at some location between the decimal digits of a number.
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:
It is possible to performaddition 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 24 = 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:
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 ahalf-carry flag to facilitate BCD arithmetic adjustments following binary addition and subtraction operations. TheIntel 8080, theZilog Z80 and the CPUs of the x86 family provide the opcode DAA (Decimal Adjust Accumulator).
Subtraction is done by adding the ten's complement of thesubtrahend to theminuend. To represent the sign of a number in BCD, the number 0000 is used to represent apositive number, and 1001 is used to represent anegative 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 thenine'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:
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:
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.
The IBM 1400 series are character-addressable machines, each location being six bits labeledB, A, 8, 4, 2 and1, plus an odd parity check bit (C) and a word mark bit (M). For encoding digits1 through9,B andA are zero and the digit value represented by standard 4-bit BCD in bits8 through1. For most other characters bitsB andA are derived simply from the "12", "11", and "0" "zone punches" in thepunched card character code, and bits8 through1 from the1 through9 punches. A "12 zone" punch set bothB andA, an "11 zone" setB, and a "0 zone" (a 0 punch combined with any others) setA. Thus the letterA, which is(12,1) in the punched card format, is encoded(B,A,1). The currency symbol$,(11,8,3) in the punched card, was encoded in memory as(B,8,2,1). This allows the circuitry to convert between the punched card format and the internal storage format to be very simple with only a few special cases. One important special case is digit0, represented by a lone0 punch in the card, and(8,2) in core memory.[43]
The memory of the IBM 1620 is organized into 6-bit addressable digits, the usual8, 4, 2, 1 plusF, used as a flag bit andC, an odd parity check bit. BCDalphamerics are encoded using digit pairs, with the "zone" in the even-addressed digit and the "digit" in the odd-addressed digit, the "zone" being related to the12,11, and0 "zone punches" as in the 1400 series. Input/output translation hardware converted between the internal digit pairs and the external standard 6-bit BCD codes.
In the decimal architectureIBM 7070,IBM 7072, andIBM 7074alphamerics are encoded using digit pairs (usingtwo-out-of-five code in the digits,not BCD) of the 10-digit word, with the "zone" in the left digit and the "digit" in the right digit. Input/output translation hardware converted between the internal digit pairs and the external standard 6-bit BCD codes.
With the introduction ofSystem/360, IBM expanded 6-bit BCDalphamerics to 8-bit EBCDIC, allowing the addition of many more characters (e.g., lowercase letters). A variable length packed BCDnumeric data type is also implemented, providing machine instructions that perform arithmetic directly on packed decimal data.
On theIBM 1130 and1800, packed BCD is supported in software by IBM's Commercial Subroutine Package.
Today, BCD data is still heavily used in IBM databases such asIBM Db2 and processors such asz/Architecture andPOWER6 and laterPower ISA processors. In these products, the BCD is usually zoned BCD (as in EBCDIC or ASCII), packed BCD (two decimal digits per byte), or "pure" BCD encoding (one decimal digit stored as BCD in the low four bits of each byte). All of these are used within hardware registers and processing units, and in software.
The Digital Equipment CorporationVAX series includesinstructions that can perform arithmetic directly on packed BCD data and convert between packed BCD data and other integer representations.[41] The VAX's packed BCD format is compatible with that on IBM System/360 and IBM's later compatible processors. The MicroVAX and later VAX implementations dropped this ability from the CPU but retained code compatibility with earlier machines by implementing the missing instructions in an operating system-supplied software library. This is invoked automatically viaexception handling when the defunct instructions are encountered, so that programs using them can execute without modification on the newer machines.
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.
There are tricks for implementing packed BCD and zoned decimal add–or–subtract operations using short but difficult to understand sequences of word-parallel logic and binary arithmetic operations.[49] For example, the following code (written inC) computes an unsigned 8-digit packed BCD addition using 32-bit binary operations:
uint32_tBCDadd(uint32_ta,uint32_tb){uint32_tt1,t2;// unsigned 32-bit intermediate valuest1=a+0x06666666;t2=t1^b;// sum without carry propagationt1=t1+b;// provisional sumt2=t1^t2;// all the binary carry bitst2=~t2&0x11111110;// just the BCD carry bitst2=(t2>>2)|(t2>>3);// correctionreturnt1-t2;// corrected BCD sum}
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 identicalseven-segment displays 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.[50][51]
Rounding at a decimal digit boundary is simpler. Addition and subtraction in decimal do not require rounding.[dubious –discuss]
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 asXML, or to drive signals for aseven-segment display) is a simple per-digit mapping, and can be done in linear (O(n)) time. Conversion from purebinary involves relatively complex logic that spans digits, and for large numbers, no linear-time conversion algorithm is known (seeBinary 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.
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.[52]
Some operations are more complex to implement.Adders require extra logic to cause them to wrap and generate a carry early. Also, 15 to 20 per cent more circuitry is needed for BCD add compared to pure binary.[citation needed] Multiplication requires the use of algorithms that are somewhat more complex than shift-mask-add (abinary 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 per cent more space than a binary encoding (the ratio of 4 bits to log210 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.
Various BCD implementations exist that employ other representations for numbers.Programmable calculators manufactured byTexas Instruments,Hewlett-Packard, and others typically employ afloating-point BCD format, typically with two or three digits for the (decimal) exponent. The extra bits of the sign digit may be used to indicate special numeric values, such asinfinity,underflow/overflow, anderror (a blinking display).
Signed decimal values may be represented in several ways. TheCOBOL programming language, for example, supports five zoned decimal formats, with each one encoding the numeric sign in a different way:
3GPP developedTBCD,[53] an expansion to BCD where the remaining (unused) bit combinations are used to add specifictelephony symbols,[54][55] similar to those intelephone keypad design.
Decimal digit
TBCD 8 4 2 1
*
1 0 1 0
#
1 0 1 1
a
1 1 0 0
b
1 1 0 1
c
1 1 1 0
Used as filler when there is an odd number of digits
1 1 1 1
The mentioned 3GPP document definesTBCD-STRING with swapped nibbles in each byte. Bits, octets and digits indexed from 1, bits from the right, digits and octets from the left.
If errors in representation and computation are more important than the speed of conversion to and from display, a scaled binary representation may be used, which stores a decimal number as a binary-encoded integer and a binary-encoded signed decimal exponent. For example, 0.2 can be represented as 2×10−1.
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 offixed point arithmetic since the position of theradix point is implied.
TheHertz andChen–Ho encodings provide Boolean transformations for converting groups of three BCD-encoded digits to and from 10-bit values[nb 1] that can be efficiently encoded in hardware with only 2 or 3 gate delays.Densely packed decimal (DPD) is a similar scheme[nb 1] that is used for most of thesignificand, except the lead digit, for one of the two alternative decimal encodings specified in theIEEE 754-2008 floating-point standard.
TheBIOS in manypersonal computers stores the date and time in BCD because theMC6818 real-time clock chip used in the originalIBM PC AT motherboard provided the time encoded in BCD. This form is easily converted into ASCII for display.[58][59]
TheAtari 8-bit computers use a BCD format for floating point numbers. TheMOS Technology 6502 processor has a BCD mode for the addition and subtraction instructions. ThePsion Organiser 1 handheld computer's manufacturer-supplied software also uses BCD to implement floating point; later Psion models use binary exclusively.
Early models of thePlayStation 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 BCDwere misinterpreted as 16 causing an error in the unit's date, rendering most functions inoperable. This has been referred to as theYear 2010 problem.
The decision noted that a patent "would wholly pre-empt the mathematical formula and in practical effect would be a patent on thealgorithm itself".[60] This was a landmark judgement that determined thepatentability of software and algorithms.
^abcIn a standard packed 4-bit representation, there are 16 states (four bits for each digit) with 10tetrades and 6pseudo-tetrades, whereas in more densely packed schemes such asHertz,Chen–Ho orDPD encodings there are fewer—e.g., only 24unused states in 1024 states (10 bits for three digits).
^abcdeCode 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.
^TheAiken code is one of several 2 4 2 1 codes. It is also known as 2* 4 2 1 code.
^The Jump-at-8 code is also known as unsymmetrical 2 4 2 1 code.
^abcKlar, Rainer (1989) [1988-10-01]. "1.4 Codes: Binär verschlüsselte Dezimalzahlen" [1.4 Codes: Binary coded decimal numbers].Digitale Rechenautomaten – Eine Einführung in die Struktur von Computerhardware [Digital Computers – An Introduction into the structure of computer hardware]. Sammlung Göschen (in German). Vol. 2050 (4th reworked ed.). Berlin, Germany:Walter de Gruyter & Co. pp. 25, 28,38–39.ISBN3-11011700-2. p. 25:[…] Die nicht erlaubten 0/1-Muster nennt man auch Pseudodezimalen. […] (320 pages)
^Schneider, Hans-Jochen (1986).Lexikon der Informatik und Datenverarbeitung (in German) (2 ed.). R. Oldenbourg Verlag München Wien.ISBN3-486-22662-2.
^Tafel, Hans Jörg (1971).Einführung in die digitale Datenverarbeitung [Introduction to digital information processing] (in German). Munich:Carl Hanser Verlag.ISBN3-446-10569-7.
^Steinbuch, Karl W.; Weber, Wolfgang; Heinemann, Traute, eds. (1974) [1967].Taschenbuch der Informatik - Band II - Struktur und Programmierung von EDV-Systemen. Taschenbuch der Nachrichtenverarbeitung (in German). Vol. 2 (3 ed.). Berlin, Germany:Springer-Verlag.ISBN3-540-06241-6.LCCN73-80607.
^abcdefghijklmnBerger, Erich R. (1962). "1.3.3. Die Codierung von Zahlen". Written at Karlsruhe, Germany. InSteinbuch, Karl W. (ed.).Taschenbuch der Nachrichtenverarbeitung (in German) (1 ed.). Berlin / Göttingen / New York:Springer-Verlag OHG. pp. 68–75.LCCN62-14511. (NB. The shown Kautz code (II), containing all eight available binary states with an odd count of 1s, is a slight modification of theoriginal Kautz code (I), containing all eight states with an even count of 1s, so that inversion of the most-significant bits will create a9s complement.)
^abcdefKämmerer, Wilhelm[in German] (May 1969). "II.15. Struktur: Informationsdarstellung im Automaten". Written at Jena, Germany. InFrühauf, Hans[in German]; Kämmerer, Wilhelm; Schröder, Kurz; Winkler, Helmut (eds.).Digitale Automaten – Theorie, Struktur, Technik, Programmieren. Elektronisches Rechnen und Regeln (in German). Vol. 5 (1 ed.). Berlin, Germany:Akademie-Verlag GmbH. p. 161. License no. 202-100/416/69. Order no. 4666 ES 20 K 3. (NB. A second edition 1973 exists as well.)
^abcdefghijklmnopqDokter, Folkert; Steinhauer, Jürgen (1975) [1969].Digitale Elektronik in der Meßtechnik und Datenverarbeitung: Theoretische Grundlagen und Schaltungstechnik. Philips Fachbücher (in German). Vol. I (improved and extended 5th ed.). Hamburg, Germany:Deutsche Philips GmbH. p. 50.ISBN3-87145-272-6. (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.)
^abcdefKautz, William H. (June 1954). "IV. Examples A. Binary Codes for Decimals, n = 4".Optimized Data Encoding for Digital Computers. Convention Record of the I.R.E., 1954 National Convention, Part 4 - Electronic Computers and Information Theory. Session 19: Information Theory III - Speed and Computation. Stanford Research Institute, Stanford, California, USA:I.R.E. pp. 47–57 [49,51–52, 57].Archived from the original on 2020-07-03. Retrieved2020-07-03. p. 52:[…] 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 ofFig. 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 Δ1 and δ1. The confusion index for decimals using the criterion of "decimal change," is taken to be cij = |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. 4Minimum-confusion code for decimals. […] δ1=2 Δ1=15 […][1][2][3][4][5][6][7][8][9][10][11] (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 ascode 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. Thecode II shown here is a modification of code I discussed byBerger.)
^abStopper, Herbert (March 1960). Written at Litzelstetten, Germany.Runge, Wilhelm Tolmé (ed.). "Ermittlung des Codes und der logischen Schaltung einer Zähldekade".Telefunken-Zeitung (TZ) - Technisch-Wissenschaftliche Mitteilungen der Telefunken GMBH (in German).33 (127). Berlin, Germany:Telefunken:13–19. (7 pages)
^Paul, Matthias R. (1995-08-10) [1994]."Unterbrechungsfreier Schleifencode" [Continuous loop code]. 1.02 (in German). Retrieved2008-02-11. (NB. The author called this codeSchleifencode (English: "loop code"). It differs fromGray BCD code only in the encoding of state 0 to make it a cyclicunit-distance code for full-circle rotatoryslip ring applications. Avoiding the all-zero code pattern allows for loop self-testing and to use the data lines for uninterrupted power distribution.)
^abLedley, Robert Steven; Rotolo, Louis S.; Wilson, James Bruce (1960). "Part 4. Logical Design of Digital-Computer Circuitry; Chapter 15. Serial Arithmetic Operations; Chapter 15-7. Additional Topics".Digital Computer and Control Engineering(PDF). McGraw-Hill Electrical and Electronic Engineering Series (1 ed.). New York, USA:McGraw-Hill Book Company, Inc. (printer: The Maple Press Company, York, Pennsylvania, USA). pp. 517–518.ISBN0-07036981-X.ISSN2574-7916.LCCN59015055.OCLC1033638267.OL5776493M.SBN07036981-X. . ark:/13960/t72v3b312.Archived(PDF) from the original on 2021-02-19. Retrieved2021-02-19. p. 517:[…] 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. […][12] (xxiv+835+1 pages) (NB. Ledley classified the described cyclic code as acyclic decimal-coded binary code.)
^Petherick, Edward John (October 1953).A Cyclic Progressive Binary-coded-decimal System of Representing Numbers (Technical Note MS15). Farnborough, UK:Royal Aircraft Establishment (RAE). (4 pages) (NB. Sometimes referred to asA Cyclic-Coded Binary-Coded-Decimal System of Representing Numbers.)
^Petherick, Edward John; Hopkins, A. J. (1958).Some Recently Developed Digital Devices for Encoding the Rotations of Shafts (Technical Note MS21). Farnborough, UK:Royal Aircraft Establishment (RAE).
^abcSusskind, Alfred Kriss; Ward, John Erwin (1958-03-28) [1957, 1956]. "III.F. Unit-Distance Codes / VI.E.2. Reflected Binary Codes". Written at Cambridge, Massachusetts, USA. In Susskind, Alfred Kriss (ed.).Notes on Analog-Digital Conversion Techniques. Technology Books in Science and Engineering. Vol. 1 (3 ed.). New York, USA:Technology Press of the Massachusetts Institute of Technology /John Wiley & Sons, Inc. /Chapman & Hall, Ltd. pp. 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 theServomechanisms Laboraratory, Department of Electrical Engineering,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 is a minor derivation with the two most significant bit columns swapped to better illustrate symmetries.)
^"4.7 BCD and packed BCD integers".Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1: Basic Architecture(PDF). Version 072. Vol. 1.Intel Corporation. 2020-05-27 [1997]. pp. 3–2, 4-9–4-11 [4-10]. 253665-072US.Archived(PDF) from the original on 2020-08-06. Retrieved2020-08-06. p. 4-10:[…] When operating on BCD integers ingeneral-purpose registers, 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 lowhalfbyte (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 inx87FPU 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. Theleast-significant digit is contained in the lower half-byte of byte 0 and themost-significant digit is contained in the upper half-byte of byte 9. The most significant bit of byte 10 contains thesign bit (0 = positive and 1 = negative; bits 0 through 6 of byte 10 aredon't care bits). Negative decimal integers are not stored intwo'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 −1018 + 1 to 1018 − 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 thedouble-extended-precision floating-point format. All decimal integers are exactly representable in double extended-precision format. […][13]
Shirazi, Behrooz; Yun, David Y. Y.; Zhang, Chang N. (March 1988).VLSI designs for redundant binary-coded decimal addition. IEEE Seventh Annual International Phoenix Conference on Computers and Communications, 1988.IEEE. pp. 52–56.
Brown; Vranesic (2003).Fundamentals of Digital Logic.
Thapliyal, Himanshu; Arabnia, Hamid R. (November 2006).Modified Carry Look Ahead BCD Adder With CMOS and Reversible Logic Implementation. Proceedings of the 2006 International Conference on Computer Design (CDES'06). CSREA Press. pp. 64–69.ISBN1-60132-009-4.
Kaivani, A.; Alhosseini, A. Zaker; Gorgin, S.; Fazlali, M. (December 2006).Reversible Implementation of Densely-Packed-Decimal Converter to and from Binary-Coded-Decimal Format Using in IEEE-754R. 9th International Conference on Information Technology (ICIT'06).IEEE. pp. 273–276.