Accuracy of Transcendental Functions

While we credit Hewlett-Packard introducing in January 1972 with the legendary HP-35 the World's first pocket sized electronic calculator performing both logarithmic and trigonometric functions, was it Texas Instruments defining in January 1974 with the "Slide Rule" SR-50 the gold standard of algorithm accuracy used with Scientific calculators. Hewlett-Packard had to juggle the tradeoffs between accuracy and speed of the algorithm used to implement the transcendental functions of the HP-35 with its bit-serial architecture and TI's team optimized their design accordingly. Utilizing both a digit-serial architecture and dedicated memory space for constants used in these algorithm with a precision of 13 digits and accessible within one instruction cycle of the Arithmetic Chip, scored the SR-50 in the precision of the internal algorithm very well and outperformed competitors for years to come.

A handy tool to demonstrate the accuracy of the implemented algorithm of transcendental functions is Mike Sebastian's "Calculator Forensics" test and comparing the result of the expression arcsin(arccos(arctan(tan(cos(sin (9)))))) with the expected result of 9 (with the calculator in degrees mode):

Hewlett-Packard HP-35 (w/ ROM bug): 9.002983113
Hewlett-Packard HP-35 (final version): 9.004076901
Texas Instruments SR-50 (first design): 9.000005272880
Texas Instruments SR-50 (final version): 9.000004661314

It is obvious that the HP-35 is accurate to two digits behind the decimal point while the SR-50 gives much better 4 or 5 digits. Another difference is the number of digits itself, the HP-35 uses 11 digits with an internal roundoff in the 11th place for its 10-digit display of the mantissa of floating point numbers while the SR-50, depending on its ROM Version, uses 13 digits for its 10-digit display for the mantissa. These extra digits used in the computing algorithm are called "Guarding Digits" and are rounded accordingly for the display purposes but can make a big difference in their accuracy.

A transcendental function is an analytic function that does not satisfy a polynomial equation, meaning a function not expressible as a finite combination of the algebraic operations of addition, subtraction, multiplication, division, raising to a power, and extracting a root. Examples include the functions log x, sin x, cos x, ex and any functions containing them. There are various algorithm known for transcendental functions but most of them tended to be too slow for an implementation on the HP-35 and the design team finally decided for an iterative pseudo-division and pseudo-multiplication method first described in 1624 by Henry Briggs and all ready used in their HP-9100 Desktop calculator.

The number "9" might look rather innocent but in Mike's test it separates the wheat from the chaff:

The first expression, sin(9) returns an answer of about 0.156434465040231 - obviously pretty close to "0"
Next expression is cos(previous result) or cosine of an angle almost 0 which gives a number close to 1
Assuming now an algorithm rounding to only 5 digits, cos(0.15643) returns an answer of about 0.999996272955653, rounding to 1
Next expression is tan(1) = 0.017455064928218, rounded to 0.017455
Next expression arctan(0.01745) = 0.999996281020253, rounded to 1. And the algorithm just failed Mike's test!
With the next expression arccos(1) = 0, rounded to 0
And the final expression arcsin(0) = 0 returns a result that is a far cry from the expected "9" but actually observed by Mike with various calculators

Interested how other electronic calculators score in Mike's test? He maintains a complete list of test results here.


horizontal rule

If you have additions to the above article please email:

Joerg Woerner, August 25, 2023. No reprints without written permission.