Chen–Ho encoding

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

Chen–Ho encoding is an efficient alternate system of binary encoding for decimal digits.

The traditional system of binary encoding for decimal digits, known as binary-coded decimal (BCD), uses four bits to encode each digit, resulting in significant wastage of binary data bandwidth (since four bits can store 16 states and are being used to store only 10).[1]

The concepts behind Chen–Ho encoding were first introduced in a memo from Tien Chi Chen[2] to Irving T. Ho[3] in 1971. Both men were working for IBM at the time, although in different locations.[4][5] Tien Chi Chen also consulted with Frank C. Tung[6] to verify the results of his theories independently.[4]

Tien Chi Chen noted that the digits zero through seven were simply encoded using three binary digits. He also postulated that one could use a flag to identify a different encoding for the digits eight and nine, which would be encoded using a single bit.

Application

In practice, a series of boolean transformations are applied to the stream of input bits, compressing BCD encoded digits from 12 bits per three digits to 10 bits per three digits. Reversed transformations are used to decode the resulting coded stream to BCD. Equivalent results can also be achieved by the use of a look-up table.

The final version of Chen–Ho encoding was published in 1975 in the journal Communications of the Association for Computing Machinery (CACM).[7][8] This version included several refinements, primarily related to the application of the encoding system. It constitutes a Huffman-like prefix code.

Chen–Ho encoding is limited to encoding sets of three decimal digits into groups of 10 bits (so called declets).[1] Of the 1024 states possible by using 10 bits, it leaves only 24 states unused[1] (with don't care bits typically set to 0 on write and ignored on read). With only 0.34% wastage it gives a 20% more efficient encoding than BCD with one digit in 4 bits.[4][8]

One prominent application uses a 128-bit register to store 33 decimal digits with a three digit exponent, effectively not less than what could be achieved using binary encoding (whereas BCD encoding would need 144 bits to store the same amount of digits).

Chen-Ho decimal data encoding for a single declet
Binary encoding Decimal digits
Code space (1024 states) b9 b8 b7 b6 b5 b4 b3 b2 b1 b0 d2 d1 d0 Values encoded Description Possibilities (1000 states)
50.0% (512 states) 0 a b c d e f g h i 0abc 0def 0ghi (0–7) (0–7) (0–7) Three lower digits 51.2% (512 states)
37.5% (384 states) 1 0 0 c d e f g h i 100c 0def 0ghi (8–9) (0–7) (0–7) Two lower digits,
one higher digit
38.4% (384 states)
1 0 1 c a b f g h i 0abc 100f 0ghi (0–7) (8–9) (0–7)
1 1 0 c d e f a b i 0abc 0def 100i (0–7) (0–7) (8–9)
9.375% (96 states) 1 1 1 c 0 0 f a b i 0abc 100f 100i (0–7) (8–9) (8–9) One lower digit,
two higher digits
9.6% (96 states)
1 1 1 c 0 1 f d e i 100c 0def 100i (8–9) (0–7) (8–9)
1 1 1 c 1 0 f g h i 100c 100f 0ghi (8–9) (8–9) (0–7)
3.125% (32 states, 8 used) 1 1 1 c 1 1 f (0) (0) i 100c 100f 100i (8–9) (8–9) (8–9) Three higher digits, bits b2 and b1 are don't care 0.8% (8 states)

Related encoding schemes

Chen also proposed a similar, but less efficient encoding scheme to compress sets of two decimal digits (requiring 8 bits in BCD) into groups of 7 bit.[4]

In 2002, Mike F. Cowlishaw published a further refinement of Chen–Ho encoding known as Densely Packed Decimal encoding (DPD) in IEE Proceedings – Computers and Digital Techniques.[9][10] Densely Packed Decimal has subsequently been adopted as the decimal encoding used in the IEEE 754-2008 and ISO/IEC/IEEE 60559:2011 floating-point standards.

See also

References

  1. 1.0 1.1 1.2 Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. 4.0 4.1 4.2 4.3 Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. 8.0 8.1 Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.
  10. Lua error in package.lua at line 80: module 'strict' not found.