Numerical accuracy

The first test performs ten times a square-root calculation, starting with the number 2. Afterwards the result is squared ten times. In a perfect world the final result would restore the number 2. The table gives the difference between the real result and 2.

The second test checks the trigonometric functions sin, cos, tan and their inverse functions. It is performed in Degree-mode. Starting with the number 1 the operations sin, cos, tan, tan-1, cos-1 and sin-1 are performed in succession. The difference between the end result and the ideal answer (1) is printed in the table.
Stacks Image 85
It seems Hewlett-Packard got their square root algorithm pretty good already in the first calculator. They apparently didn't change it until the introduction of the HP75 in 1984 which first implemented the IEEE floating point standard. Until today, HP has made no further changes.
The trigonometric functions were not so good in the beginning and Hewlett-Packard improved them already in 1976. They improved again with the HP-75 and continued to use the same algorithms from there on.

Texas Instruments used a better algorithm (or more digits) than Hewlett-Packard to perform square root calculations from the start and improved again several times until the introduction of the first graphing calculator in 1992. Surprisingly, even todays TI CAS calculators use the same algorithm as the TI-85.
The trigonometric functions were on a similar level with HP back in 1977 when the TI-59 was introduced. They were also improved several times and remained the same after 1992 - just as the square root algorithm.


To measure speed I have used the calculators to factor the number 14462809 into it's primes (3803 x 3803).
Some later CAS models have a built in function (FACTOR) to perform this operation but all earlier calculators had to be programmed by hand:
Stacks Image 86
There are some remarkable findings here. For example the advanced HP67 is somewhat slower than the lower model HP-25C of the same year. Most surprisingly TI's highly acclaimed TI-59 falls short of it's direct competitor the HP-67.
When Hewlett-Packard moved to BASIC with the HP-75 and HP-71, speed went up considerably. But later models went back to key code programing and were slower again. Funny, the TI-95 has a built in software-ROM routine for prime factors which is much slower than my hand made key code program.
It is also surprising to see the late HP-35s fall behind the much older HP-32SII considerably.
TI's CAS machines Voyage 200 and TI-nspire both have a built in factor command which works amazingly fast.
Stacks Image 87

Here is the key code program for the prime factorization.
It was written for the HP-35s but will work in most recent Hewlett-Packard calculators with minor modifications starting with the HP-32S of 1988.
Certainly the main routine (LBL B) can be optimized but this is just for comparison.
5 A$="1"
10 Input "Factors of ?";Z$
20 Z=VAL(Z$)
30 IF MOD(Z,2)<>0 THEN GOTO 100
40 A$=A$ & "*2"
50 Z=Z/2
60 GOTO 30
100 F=3
110 IF MOD(Z,F)=0 THEN GOTO 200
120 F=F+2
140 PRINT Z$ & "=" & A$ & "*" & STR$(Z)
150 END
200 A$=A$ & "*" & STR$(F)
210 Z=Z/F
220 GOTO 110
This is a BASIC program written in HP-71B's dialect. But the code should be pretty easy to follow.
Finally the Prime function, which returns the first prime divisor of the given number, in TI-BASIC for the TI-89, Voyage 200, TI-nspire etc.
Local t,h
If fpart(z/2)=0 Then
Return 2
While t≤h
If fpart(z/t)=0 Then
Return t
Return z