ArticleslgStudy

science

Densely packed decimal

Densely packed decimal is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Densely packed decimal rather than just read about it. In short: Densely packed decimal (DPD) is an efficient method for binary encoding 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), even when using packed BCD.

Key takeaways

  • Densely packed decimal belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Densely packed decimal to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Densely packed decimal from memory before moving on to harder problems.

Reference excerpt

Densely packed decimal (DPD) is an efficient method for binary encoding 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), even when using packed BCD. Densely packed decimal is a more efficient code that packs three digits into ten bits using a scheme that allows compression from, or expansion to, BCD with only two or three hardware gate delays. 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 three-digit encoding. This means that arbitrary numbers of decimal digits (not only 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 ten binary bits and the remaining two decimal digits can be encoded using a further seven binary bits. The subset encoding mentioned above is simply the rightmost bits of the standard three-digit encoding; the encoded value can be widened simply by adding leading 0 bits. All seven-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 eight bits for BCD, but the above property requires that the DPD encoding must fit into seven 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 three base-5 digits to seven 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.

History In 1969, Theodore M. Hertz, and in 1971, Tien Chi Chen (陳天機) with Irving Tze Ho (何宜慈) devised lossless prefix codes (referred to as Hertz and Chen–Ho encodings) which packed three decimal digits into ten binary bits using a scheme which allowed compression from or expansion to BCD with only two or three gate delays in hardware. Densely packed decimal is a refinement of this, devised by Mike F. Cowlishaw in 2002, which was incorporated into the IEEE 754-2008 and ISO/IEC/IEEE 60559:2011 standards for decimal floating point.

Encoding Like Chen–Ho encoding, DPD encoding classifies each decimal digit into one of two ranges, depending on the most significant bit of the binary form: "small" digits have values 0 through 7 (binary 0000–0111), and "large" digits, 8 through 9 (binary 1000–1001). Once it is known or has been indicated that a digit is small, three more bits are still required to specify the value. If a large value has been indicated, only one bit is required to distinguish between the values 8 or 9. When encoding, the most significant bits of each of the three digits to be encoded determine one of eight coding patterns for the remaining bits, according to the following table. The table shows how, on decoding, the ten bits of the coded form in columns b9 through b0 are copied into the three digits d2 through d0, and the remaining bits are filled in with constant zeros or ones.

Bits b7, b4 and b0 (c, f and i) are passed through the encoding unchanged, and do not affect the meaning of the other bits. The remaining seven bits can be considered a seven-bit encoding for three base-5 digits. Bits b8 and b9 are not needed and ignored when decoding DPD groups with three large digits (marked as "x" in the last row of the table above), but are filled with zeros when encoding. The eight decimal values whose digits are all 8s or 9s have four codings each. The bits marked x in the table above are ignored on input, but will always be 0 in computed results. (The 3 × 8 = 24 non-standard encodings fill in the gap between 103 = 1000 and 210 = 1024.)

Examples This table shows some representative decimal numbers and their encodings in BCD, Chen–Ho, and densely packed decimal (DPD):

See also Binary-coded decimal (BCD) Binary integer decimal (BID) decimal32 floating-point format decimal64 floating-point format decimal128 floating-point format DEC RADIX 50 / MOD40 IBM SQUOZE

References

Further reading Cowlishaw, Michael Frederic (2003-02-25) [2002-05-20, 2001-01-27]. "Decimal to binary coder/decoder" (US Patent). Armonk, New York, USA: International Business Machines Corporation (IBM). US6525679B1. Retrieved 2018-07-18 {{cite web}}: More than one of |location= and |publication-place= specified (help) [1] and Cowlishaw, Michael Frederic (2007-11-07) [2004-01-14, 2002-08-14, 2001-09-24, 2001-01-27]. "Decimal to binary coder/decoder" (European Patent). Armonk, New York, USA: International Business Machines Corporation (IBM). EP1231716A2. Retrieved 2018-07-18. {{cite web}}: More than one of |location= and |publication-place= specified (help) [2][3][4] (NB. This patent is about DPD.) Bonten, Jo H. M. (2009-10-06) [2006-10-05]. "Packed Decimal Encoding IEEE-754-2008". Geldrop, Netherlands. Archived from the original on 2018-07-11. Retrieved 2018-07-11. (NB. An older version can be found here: Packed Decimal Encoding IEEE-754r.) Savard, John J. G. (2018) [2007]. "Chen–Ho Encoding and Densely Packed Decimal". quadibloc. Archived from the original on 2018-07-03. Retrieved 2018-07-16.

Worked examples

Example 1 — a first encounter with Densely packed decimal

Start with the simplest possible case. Write down what Densely packed decimal claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Densely packed decimal before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Densely packed decimal ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Densely packed decimal

In research
Densely packed decimal appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Densely packed decimal in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Densely packed decimal is common in secondary-school and first-year university syllabi. It links to neighbouring topics 2002 in science, 2002 introductions, Binary arithmetic, so understanding it makes those chapters shorter.
In everyday life
Look for Densely packed decimal outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Densely packed decimal” →

How to study Densely packed decimal in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Densely packed decimal means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Densely packed decimal out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Densely packed decimal in simple terms?

Densely packed decimal (DPD) is an efficient method for binary encoding 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…

Why does Densely packed decimal matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Densely packed decimal?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Densely packed decimal.

Tags

  • 2002 in science
  • 2002 introductions
  • Binary arithmetic

Keep exploring