Talk:Chen–Ho encoding

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

How does it work?[edit]

Can anyone add a encoding/decoding algorithm and an example code table or so? the Densely packed decimal article has a table for comparison between Chen-Ho and DPD but it does not explain how the Chen-Ho-encoded values were calculated. --RokerHRO (talk) 12:54, 9 February 2010 (UTC)[reply]

Efficiency percentages[edit]

The article mentions that

With only 0.34% wastage it gives a 20% more efficient encoding than BCD [...]

These percentages are properly cited, but are they correct? Feeling that a 20% gain on a highly inefficient encoding was not really worthwhile, I wanted to see if what was meant was a 20 percentage point gain instead. While thinking more about it, I think I initially interpreted efficiency wrongly due to its pairing with the word wastage. However, it turned out I could not reproduce the percentages at all. Isn't the following correct? If so, I think we should have the proper percentages but without a citation.

BCD uses 16 states to represent 10 states. This is an efficiency of = 62.5%, wasting 37.5% of the encoding space.

Chen-Ho uses 1024 states to represent 1000 states in its most optimal form (three digits). This is an efficiency of 97.66%, wasting about 2.34% of the space. Interestingly, the digits are similar to the stated 0.34%, even though they differ by an order of magnitude.

This is looking at it from an information entropy standpoint. If we want to define wastage, I think that's correct. But we can interpret efficiency in a different manner: relative storage requirements of the formats. I think this is what Chen meant when he wrote in the cited source:

[...], leading to a 20% gain in the number of bits used.

However, making a classic mistake.

BCD uses 12 bits to store a three-digit decimal number, Chen-Ho uses 10 bits. This means only 83% of the storage space is required, a 17% increase in storage efficiency. Chen's classic mistake is that he accidentally computed that BCD has a 20% efficiency loss compared to Chen-Ho instead of doing the reverse calculation.

I propose we ditch the citations for the percentages and simply state that

With only 2.34% wastage it stores data 17% more efficiently than BCD [...]

Digital Brains (talk) 11:10, 11 July 2018 (UTC)[reply]

Wastage: Agree. 0.34% looked immediately wrong to me, and no idea how it came to be.
Efficiency: Disagree. 17% is the reduction in consumption, efficiency alone I would express in dit/bit : more is better.
So Chen-Ho over BCD efficiency would be (3/10)/(3/12) = 12/10 = 1.2 = +20% indeed.
This seems like the classic liter per kilometer vs miles per gallon.
EDIT: Actually scrap that, efficiency is direction agnostic and less can be better too, depending on what is the target vs the mean: store dits, save bits.
But still, if reversing and using bit/dit then Chen-Ho vs BCD would be minus 17% more efficient, a bit awkward. Musaran (talk) 20:50, 25 October 2023 (UTC)[reply]
I think your definition of efficiency makes sense, and it is 20% more efficient. I found your explanation elucidating, thanks! But note the quote: it says a gain in the number of bits used. I think that's bit/dit. But perhaps the problem in that quote is not the percentage but the rest of the quote :-). So it is 20% efficiency gain, but efficiency gain is not the same as gain in the number of bits used. Well, that's 12 words analysed to death. Let's just keep the 20%! Digital Brains (talk) 09:57, 26 October 2023 (UTC)[reply]