That overrated trigonometric forensic! Message #26 Posted by Karl Schneider on 5 May 2007, 2:38 a.m., in response to message #6 by Gene
Quote:
I did the usual
"9 sin cos tan atan acos asin"
a minute ago and got 9.0000000000000000005 as the answer.
All 
I know that this topic has been discussed before, but I'm still chagrined that this "calculator forensic" procedure remains so commonly accepted as a de facto standard for ostensibly assessing the quality of a calculator's general accuracy.
The prescribed mathematical calculation is
asin(acos(atan(tan(cos(sin(9 deg))))))
in degrees mode, for which the exact answer is 9. Usually, the answer returned by handheld calculators is not 9, but very close to it  within 0.0000151% (8.99999864267) for Saturnbased models, 0.00464% (9.000417403) for Spice/HP41/Voyager models, and 0.0453% (9.004076901) for the venerable HP35. The HP30S returnsobi the exact answer of 9 in this test, because it uses 80bit floatingpoint math that provides about 24 internal digits, then rounds those results that are extremely close to integers, in order to help filter out the inexactitude of floatingpoint representation.
The computational sequence is mathematically "symmetrical", but not particularly useful in common practice. Why would one take the tangent of a sine of a cosine? If the units of 9 are degrees, what are the units of sine of 9 degrees for the cosine calculation? The angular unit is assumed to be degrees, but sine produces a plain ol' number without any units of measurement.
Much of the inaccuracy is introduced by roundoff error when results are internally multiplied by 180/pi (~= 57.29578) as the last step in the arcfunctions to convert a radianvalued output to degrees. Smaller roundoff inaccuracies are also introduced during calculation of the trigonometric functions, in which each input is divided internally by 180/pi.
Obviously, the more internal digits a calculator has, the less susceptible it is to the unitconversion errors. More external digits reduce roundoff errors in the final result of each calculation that is fed to the next one. The Saturnbased models have 12 external and 15 internal digits; the Spice/HP41/Voyager models have 10 external and 13 internal. The HP35 has 10 external and presumably fewer than 13 internal.
For comparison's sake, try the same computational sequence in radians mode, in order to eliminate the errors of converting between degrees and radians. The starting value will be 9*(pi/180) radians, which is mathematically identical, save for the small roundoff error of that computation.
Saturnbased models give 0.157079632681, for an error of about 1.273E09%.
Spice/HP41/Voyager models give 0.1570796319, for an error within 5.093E07%.
Quite an improvement, I'd say  four orders of magnitude smaller in each case. It is also noteworthy that the relative errors of the Saturnbased models and their immediate predecessors differ by roughly 2.5 orders of magnitude, in either degrees or radians mode. This is consistent with the two extra internal and external digits the Saturnbased models carry.
Radians mode is not available on the HP35, but the HP45 produces a result of 0.1570796336, for an error of 5.730E07%. (A "thanks" to Gerson Barbosa)
Another difference of the HP35 from the later models is that it does not seem to maintain ten significant digits to match its ten displayed digits. For example, the results of the three trigonometric functions are as follows:
Model tan(cos(sin(9 deg)))
HP42S 0.0174549998555
HP11C 0.01745499985
HP35 0.0174549998
The above is not intended to assert that the "forensic technique" has no value. The number of internal, external (displayable), and significant digits carried, as well as the algorithmic sophistication, will be reflected in the final result obtained. Still, it is instructive to know why a given result was obtained, and to use diagnostic/forensic calcuations that are valid in realworld applications.
 KS
Edited: 6 May 2007, 12:04 a.m. after one or more responses were posted
