|That over-rated trigonometric forensic!|
Message #26 Posted by Karl Schneider on 5 May 2007, 2:38 a.m.,
in response to message #6 by Gene
I did the usual
"9 sin cos tan atan acos asin"
a minute ago and got 9.0000000000000000005 as the answer.
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
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 Saturn-based models, 0.00464% (9.000417403) for Spice/HP-41/Voyager models, and 0.0453% (9.004076901) for the venerable HP-35. The HP-30S returnsobi the exact answer of 9 in this test, because it uses 80-bit floating-point 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 floating-point 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 arc-functions to convert a radian-valued 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 unit-conversion errors. More external digits reduce roundoff errors in the final result of each calculation that is fed to the next one. The Saturn-based models have 12 external and 15 internal digits; the Spice/HP-41/Voyager models have 10 external and 13 internal. The HP-35 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.
Saturn-based models give 0.157079632681, for an error of about 1.273E-09%.
Spice/HP-41/Voyager models give 0.1570796319, for an error within 5.093E-07%.
Quite an improvement, I'd say -- four orders of magnitude smaller in each case. It is also noteworthy that the relative errors of the Saturn-based 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 Saturn-based models carry.
Radians mode is not available on the HP-35, but the HP-45 produces a result of 0.1570796336, for an error of 5.730E-07%. (A "thanks" to Gerson Barbosa)
Another difference of the HP-35 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)))
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 real-world applications.
Edited: 6 May 2007, 12:04 a.m. after one or more responses were posted