Talk:Densely packed decimal
This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
|
Cryptic Sentence
editThe proper way to parse this sentence isn't obvious to me. Could someone clarify? "For example, 38=12×3+2 decimal digits can be encoded in 12×10+7=127 bits." Sumguysr (talk) 07:34, 23 December 2011 (UTC)
- 12 sets of three decimal digits can be encoded using 12 sets of 10 binary bits. The remaining two decimal digits can be encoded using 7 binary bits. I'll add that to the article. mfc (talk) 15:30, 31 December 2011 (UTC)
Chen-Ho encoding
editShouldn't the Chen-Ho encoding for 009 be 110 000 0001? --Wm243 (talk) 12:48, 17 April 2009 (UTC)
- Indeed it should -- well spotted. (Fixed.) mfc (talk) 15:05, 17 April 2009 (UTC)
Yes, but what is it?
editThe article should explain how the scheme actually works. Superm401 - Talk 15:25, 11 November 2007 (UTC)
- You're probably right. Suggestions? mfc 15:52, 15 November 2007 (UTC)
Copyright
editI also just realized many parts are identical to the original paper (http://speleotrove.com/decimal/DPDecimal.html), which says it's copyrighted by IBM. Superm401 - Talk 15:34, 11 November 2007 (UTC)
- See the history of the page; I contributed the initial text for this page (on request), and I am also the author of the referenced paper and summary page and so it is my copyright. It is quite likely I used similar or identical words in the two places. IBM has the use of the text, too, as does Wikipedia, but not exclusively. mfc 15:51, 15 November 2007 (UTC)
Uses for the 24 redundant codes
editPossible uses for the 24 redundant codes.
- HIGH-VALUES: Not useful for arithmetic, but useful for sorting and for the initial value of "min".
- LOW-VALUES: Like HIGH-VALUES, but a better initial value for "max".
- +INFINITY: Note: HIGH-VALUES > +INFINITY
- -INFINITY: Note: LOW-VALUES < -INFINITY
- -0: "Negative zero", useful for meteorologists, is slightly less than 0, i.e., 0 - epsilon
- +0: Slightly more than 0, i.e., 0 + epsilon. For symmetry with -0. The canonical zero can then be "exactly zero" which will kill the "numberness" of 1/x and ln x, etc.
- NaN: Not a Number.
- NaDPD: Not a Densely Packed Decimal. Unicode has demonstrated the value of a "not one of mine" code, hasn't it? It can serve as a separator, for example. 111 111 1 111 would be quite suitable.
- ROUND-UP: Not so much a value as a flag for the DPD ALU (arithmetic-logic unit).
- ROUND-DOWN: ditto
- ROUND-TO-ZERO: ditto
- ROUND-TO-EVEN: ditto
- ROUND-TO-ODD: ditto
- ROUNDING: A query to the PDP ALU to report its rounding mode with one of the codes above. E.g.
dpd old_rounding = 0 + ROUNDING;
dpd new_rounding = 0 + ROUND-UP;
111 111 1 111 NaDCD 111 111 1 110 NaN ...
mjk (talk) 22:50, 25 March 2008 (UTC)
- OK, on further thought, it is strange to have negative values for a representation that is predestined for a sign-magnitude implementation. So forget about -INFINITY, +0, -0, and add:
- EPSILON: which can be used by meteorologists, etc. with a sign, EPSILON replacing +0 and -EPSILON replacing -0.
- CR: to explicitly indicate non-negatives, or "credits".
- DB: to explicitly indicate negatives, or "debits".
- mjk (talk) 13:03, 30 April 2008 (UTC)
Most applications won't use DPD for anything special beyond encoding decimal numbers. 24691358r (talk) 13:23, 20 May 2017 (UTC)
- Let alone all of your suggested codes. 202.79.134.100 (talk) 08:42, 13 March 2018 (UTC)
Other bases
editIt's possible to have a similar system for other bases, for example storing 5 Ternary numeral system in a byte (3⁵=243 on 2⁸=256), as shown below:
000xxxxx — xxxxx
0010xxxx — xxxx2
0011xxxx — xxx2x
0100xxxx — xx2xx
0101xxxx — x2xxx
0110xxxx — 2xxxx
01110xxx — xxx22
01111xxx — xx2x2
10000xxx — xx22x
10001xxx — x2xx2
10010xxx — x2x2x
10011xxx — x22xx
10100xxx — 2xxx2
10101xxx — 2xx2x
10110xxx — 2x2xx
10111xxx — 22xxx
110000xx — xx222
110001xx — x2x22
110010xx — x22x2
110011xx — x222x
110100xx — 2xx22
110101xx — 2x2x2
110110xx — 2x22x
110111xx — 22xx2
111000xx — 22x2x
111001xx — 222xx
1110100x — x2222
1110101x — 2x222
1110110x — 22x22
1110111x — 222x2
1111000x — 2222x
11110010 — 22222
where x means 0 or 1. Uses are for example densely storing an uncompressed 3–color image. 202.79.134.100 (talk) 08:42, 13 March 2018 (UTC)
Improve table for clarity
editI don't know how to edit the table
DPD encoded value | Decimal digits | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Code space (1024 states) |
b9 | b8 | b7 | b6 | b5 | b4 | b3 | b2 | b1 | b0 | d2 | d1 | d0 | Values encoded | Description | Occurrences (1000 states) | |
50.0% (512 states) |
a | b | c | d | e | f | 0 | g | h | i | 0abc | 0def | 0ghi | (0–7) (0–7) (0–7) | 3 small digits | 51.2% (512 states) | |
37.5% (384 states) |
a | b | c | d | e | f | 1 | 0 | 0 | i | 0abc | 0def | 100i | (0–7) (0–7) (8–9) | 2 small digits, 1 large digit |
38.4% (384 states) | |
a | b | c | g | h | f | 1 | 0 | 1 | i | 0abc | 100f | 0ghi | (0–7) (8–9) (0–7) | ||||
g | h | c | d | e | f | 1 | 1 | 0 | i | 100c | 0def | 0ghi | (8–9) (0–7) (0–7) | ||||
9.375% (96 states) |
g | h | c | 0 | 0 | f | 1 | 1 | 1 | i | 100c | 100f | 0ghi | (8–9) (8–9) (0–7) | 1 small digit, 2 large digits |
9.6% (96 states) | |
d | e | c | 0 | 1 | f | 1 | 1 | 1 | i | 100c | 0def | 100i | (8–9) (0–7) (8–9) | ||||
a | b | c | 1 | 0 | f | 1 | 1 | 1 | i | 0abc | 100f | 100i | (0–7) (8–9) (8–9) | ||||
3.125% (32 states, 8 used) |
x | x | c | 1 | 1 | f | 1 | 1 | 1 | i | 100c | 100f | 100i | (8–9) (8–9) (8–9) | 3 large digits, b9, b8: don't care |
0.8% (8 states) |
That table could be more easy to read if the last column had the observation that a b3=0, b3=1 and b2b1<11 for just one 9-8 digit, b3=1 and b2b1=11 and b6b5<11 for two 9-8 digits, and b3=1 and b2b1=11 and b6b5=11 for three 9-8 digits.
something like:
or
not all the lengthly text, maybe just the antecedent of the implication is needed.
Colors may also help. Is just a matter to do the changes to see what is visually more clear and aesthetic.
References
- ^ Cowlishaw, Michael Frederic (2007-02-13) [2000-10-03]. "A Summary of Densely Packed Decimal encoding". IBM. Archived from the original on 2015-09-24. Retrieved 2016-02-07.
-- (unsigned) 2018-09-15T10:56:20 2806:107e:c:f09:218:deff:fe2b:121