Talk:Binary-coded decimal/Archives/2018/March
Latest comment: 9 years ago by Gah4 in topic compressed vs uncompressed
This is an archive of past discussions about Binary-coded decimal. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
compressed vs uncompressed
If the number has an odd number of digits the compressed version will most likely need a leading 0 to byte-align. Thus an uncompressed number '1', 0x31 will be be 0x01 in compressed BCD, or the same size. On the other hand '32' (0x3332) will be 0x32, of half the size. I don't thing a categorical statement is possible regarding the size difference between compressed and uncompressed. This leaves the question of sign completely out. Peter Flass (talk) 03:20, 5 February 2015 (UTC)
- Nope - as written the sentence specifies uncompressed "with the leading zero", implying an even number of digits, though without actually saying so, The statement was therefore correct, so I just changed "100 percent more" to "twice", which I think is clearer. Peter Flass (talk) 03:28, 5 February 2015 (UTC)
- Thanks. That seems about the best that can be done. A description that correctly covers all conditions would be very complex. Consider that if only ONE digit is stored, then assuming we can't use just half a byte for packed decimal, they both take the same number of bytes! Jeh (talk) 03:39, 5 February 2015 (UTC)
Also, one usually has to store the sign somewhere. The usual packed decimal representations hold an odd number of digits, so the leading zero is on values with an even number of digits. Gah4 (talk) 21:36, 17 September 2015 (UTC)