Densely Packed Decimal

Densely packed decimal (DPD) is a 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). Densely packed decimal is a more efficient code that packs three digits into 10 bits using a scheme that allows compression from, or expansion to, BCD with only two or three gate delays in hardware.

The densely packed decimal encoding is a refinement of Chen–Ho encoding; it gives the same compression and speed advantages, but the particular arrangement of bits used confers additional advantages:

  • Compression of one or two digits (into the optimal four or seven bits respectively) is achieved as a subset of the 3-digit encoding. This means that arbitrary numbers of decimal digits (not just multiples of three digits) can be encoded efficiently. For example, 38=12×3+2 decimal digits can be encoded in 12×10+7=127 bits – that is, 12 sets of three decimal digits can be encoded using 12 sets of 10 binary bits and the remaining two decimal digits can be encoded using a further 7 binary bits.
  • The subset encoding mentioned above is simply the rightmost bits of the standard 3-digit encoding; the encoded value can be widened simply by adding leading 0 bits.
  • All 7-bit BCD numbers (0 through 79) are encoded identically by DPD. This makes conversions of common small numbers trivial. (This must break down at 80, because that requires 8 bits for BCD, but the above property requires that the DPD encoding must fit into 7 bits.)
  • The low-order bit of each digit is copied unmodified. Thus, the non-trivial portion of the encoding can be considered a conversion from 3 base-5 digits to 7 binary bits. Further, digit-wise logical values (in which each digit is either 0 or 1) can be manipulated directly without any encoding or decoding being necessary.

Read more about Densely Packed Decimal:  History, Encoding, Examples

Famous quotes containing the words densely, packed and/or decimal:

    I keep having the same experience and keep resisting it every time. I do not want to believe it although it is palpable: the great majority of people lacks an intellectual conscience. Indeed, it has often seemed to me as if anyone calling for an intellectual conscience were as lonely in the most densely populated cities as if he were in a desert.
    Friedrich Nietzsche (1844–1900)

    He packed a lot of things that she had made
    Most mournfully away in an old chest
    Of hers, and put some chopped-up cedar boughs
    In with them, and tore down the slaughterhouse.
    Edwin Arlington Robinson (1869–1935)

    It makes little sense to spend a month teaching decimal fractions to fourth-grade pupils when they can be taught in a week, and better understood and retained, by sixth-grade students. Child-centeredness does not mean lack of rigor or standards; it does mean finding the best match between curricula and children’s developing interests and abilities.
    David Elkind (20th century)