Musings and comments about our common interest
There is a discussion on HPmuseum.org regarding accuracy on the HP Prime. There were some simple calculations that should give zero, but that give an infinitesimal value.
The learning for me is that now I understand why there is a Home and a CAS environment. In fact, from a point of view, you have two calculators in one.
CAS should be used for exact, symbolic calculations, and implements XCAS from Parisse as well as the HP team could implement. All calculations and real numbers are represented internally with binary numbers. Therefore, decimal numbers have no exact representation in binary - and this has an effect on the accuracy of many operations.
Home should be used for normal decimal calculations. The internal system represents number in BCD, binary coded decimal. What is BCD? If you’re a frequent visitor of hpmuseum.org, you already know; if not, bear with me for a while.
the BCD format (of which HP uses the “packed” version, where an 8-bit byte contains two decimal digits, each one occupying a 4-bit word, called sometimes “nibble”) was used in early computers, like the IBM System/360 and DEC’s VAX. The drawbacks of BCD are more complex routines and slightly lower compactness; the advantage is the perfect representation of decimal magnitudes, as opposed to pure binary, that cannot represent exactly some of them; also that there are very refined algorithms for both normal arithmetic and transcendent functions. Nowadays, with enough memory and processing power, there are not too many differences between both systems when you have enough significant digits in your routines.
Most HP calculators were made to work with BCD; only the 12C Platinum comes to my mind as binary, as well as the “external job” calculators like 9s and 30s machines. So it is curious that the HP Prime is both a BCD AND a binary calculator!!