Re: Emulators Message #11 Posted by Gunnar Degnbol on 6 Nov 2004, 8:47 a.m., in response to message #10 by Thomas Okken
The biggest advantage to decimal arithmetic in an interactive calculator is WYSIWYG - the result you see is the result calculated, not the result converted from binary to decimal. If you understand that the calculation does not have infinite precision, it is not too hard to accept that 1 / 3 * 3 is 0.9999..., but 0.1 + 0.1 + 0.1 - 0.3 = 5.551115123E-17 does not make much sense.
This is less of an issue in computers (programs), where you don't see all the intermediate results.
Binary floating point is more dense than BCD, because it stores 16 values in 4 bits instead of only 10. However, BCD is not the only way to store decimal numbers. The IEEE 754R draft standard uses Densely Packed Decimal, a kind of Huffman-compressed BCD. DPD is rather complicated, but can be implemented in fast hardware.
Any decimal system represented in binary will be still slightly less dense than binary, but only by a few bits. With four bits for the mantissa, a binary format can store 4 bits of information, while a decimal format may have 4 (if the value is 8 or 9) or 1 (if the value is 1). But this difference (0-3 bits) is the same if the mantissa is 40 bits.
In Stak, my RPN calculator for mobile phones and PCs, the coefficeint (mantissa) and the exponent are binary numbers, but the exponent counts powers of ten instead of two.
Another advantage of decimal arithmetic is that it does not have to be normalized. Unnormalized arithmetic, as in Mike Cowlishaw's decimal standard, followed by IEE 754R (and my program), preserves trailing zeros which may contain information relevant to the user in the context.
|