HP12C Financial CalculatorUpdated 12 November 2023Hp12C financial calculator 1998IntroductionThe HP12C Financial Calculator is a standard device used in finance and education, for more than 41 years. The IBM PC started production in 1981, the same year as the HP12C. There is almost no other electronic design from 1981 that still can be purchased, as a new item in 2022. One item that comes to mind is my Technics turntable for playing vinyl recordings. I recently purchased a secondhand, 1998 vintage, HP12C Financial calculator from an auction at a low price. It was essentially in original condition. I thought it would be a good retirement project to turn it into a useful scientific calculator, along with the original financial functions. HP12C Financial Calculator VersionsAccording to Wikipedia the HP12C is HP's best selling product. There is a Platinum version which has up to 400 program lines, added algebraic capability and a few extra functions  including x^{2}, Undo and a Backspace key. Numerous HP12C articles can be found on the internet. The links at right are a good start. Hp12C financial calculator 1998  backI have a "Platinum" version of this calculator, also from an auction. It is a bit unusual, as it is, in fact, a standard HP12C with a "Platinum" branded faceplate. It runs 170 times faster than my original HP12C, so I am keeping it as a working calculator. This calculator did not cost much and it is otherwise in good condition. Summing 1s in a loop gives 86200 counts in 1 minute. A self test shows that the calculator manufacture date was 20150130. A DM12 calculator is available from SwissMicros. This is supplied either as a DM12 credit card sized version or a DM12L full size calculator. Both use an ARM microcontroller in a titanium case. The speed is somewhere between the two HP12C versions I have here. Two operating speeds can be set with a battery life penalty for the faster speed. There is a technical manual covering all the SwissMicros Voyager series calculators. The USB interface allows programs to be saved or loaded using a serial terminal session and a programming tool. Science Program 2The revised program I created to add scientific functions to the HP12C financial calculator is linked here: Science Program 2. I hope this is useful. The list below summarises all the functions:
Log(x) = ln(x)/ln(10) is not worth programming. If 𝝿 is required, I can simply keep 3.141592654 in a register, which requires only one program line when used in a program. Internal science functions include e^{x}, √x, ln(x), arithmetic mean, standard deviation, linear regression, y^{x}, 1/x and n!. I can easily calculate log(x), x^{2} and the Root Mean Square. Most of the functions of a basic scientific calculator are here. Trigonometric functionsThe cosine approximation cos(x) = (𝝿^{2}4x^{2})/(𝝿^{2}+x^{2}) adapts a function for sine(x) attributed to Bhaskara I, 1400 years ago in India. The cosine function can be programmed in fewer lines. Using degrees, the formula for the cosine ratio is cos(θ) =(94(θ/60)^{2})/(9+(θ/60)^{2})  modified for degree input by Thomas Klemm.
ErrorsAbsolute errors in the sine and cosine trig ratios are less than ±0.002. For the tangent, errors are mostly less than ±0.004, with a gradual increase above 70 degrees. The error is 0.15 at 85 degrees and 0.98 at 89 degrees, where the tangent is 56.31. Errors in the inverse trig functions are less than ±0.14 degrees. Calculating cos(90θ) instead of sin(θ) will improve the accuracy for small angles. Calculating sin(90θ) instead of cos(θ) will improve the accuracy for large angles. For example, sin(30) = 0.5020 while cos(9030) = 0.5000. If very accurate trigonometric functions are required then this program Tried & Tricky Trigonometrics by Valentin Abillo may suit. Inverse trig exampleWhat is the angle from ground level to the top of a dam, 5 metres high, from the position of a laserrangefinder set at ground level? The distance measured by the laserrangefinder to the top is 20 metres. A new overflow waterrace is being planned. The slope should not exceed 15 degrees. Height/hypotenuse is 5/20 = 0.25. Calculate sin^{1}(0.25).
Quartic polynomialThe Quartic polynomial starts at Line 34. a_{4}x^{4} + a_{3}x^{3} + a_{2}x^{2} + a_{1}x + a_{0} = 0. It is programmed in the form (((a_{4}x + a_{3})x + a_{2})x + a_{1})x + a_{0} = 0. The constants a_{4} to a_{0} are entered into the financial registers n, i, PV, PMT and FV. These can be used as normal registers. Zero is stored for each missing function term. A guess for x is entered and GTO 00, R/S starts the Newton Solver.
Polynomials can also be solved on the HP12C as cashflows. HP12C parallel resistanceI used the standard R=1/(1/R1+1/R2) formula which takes 7 program lines and any number of entries in sequence. The first result, for R1 and R2 in parallel, is pushed onto stack level y when a third R3 entry is made. The program is then repeated, etc.
Entering a negative second resistance gives a resistance to add in parallel with the first resistance so that the combination equals the second resistance. For example 10 Enter 6.6667 CHS R/S CHS = 20. Harmonic mean
The harmonic mean is used to average rates. For example a trip was 10 km at 100 km/h. A second trip was 20 km at 60 km/h, which is also two 10 km trips at 60 km/h. The average speed of 3 trips of the same distance was 3 x 1/(1/100 + 1/60 + 1/60) = 69.23 km/h. GTO 52 100 ENTER 60 R/S to start, then 60 R/S. The harmonic mean = 23.08 x 3 km/h = 69.23 km/h. Geometric mean
A geometric mean might be used for numbers which cover a wide range, or are exponentially related. Comparing the mean diameter of the earth at 12,742,000 m to the diameter of a silicon atom at 2.22^{10} m generates a geometric mean = √(1.2742^{7} x 2.22^{10}) = 0.0532 m = 53.2 mm. This is close to the 52.4 mm diameter of a Snooker ball. GTO 58 R/S 1.2742 EXX 7 R/S 2.22 EEX CHS 10 R/S. The geometric mean = 53.2 mm. My simple interpretation is that the number of silicon atoms that can pack into the volume of a 53.2 mm diameter ball is the same as the number of 53.2 mm diameter balls that can pack into a volume the size of the Earth. Other means of 1 to 6
HP12C Newton solverOne of the best function solvers is Newton’s method for solving f(x)=0. I adapted this HP12C Newton Solver, which has a simple program structure. This version is close to the shortest version I have seen. I added rounding where the iteration finish time depends on the number of decimal digits displayed. The program lines between 4 and 64 can be used to solve any functions of the form f(x)=0. At Line 03 enter the first program line. At the end of the function add GTO 70. In RUN mode, enter GTO 00. Enter a guess x and R/S to start. There is a PSE at Line 84 to allow progress to be monitored. Function call summaryThe HP12c uses GTO statements in place of the missing LBL and RTN statements. Also there are only 99 programming lines. Writing long programs can be challenging. Lines that a user might access or alter
Lines called by GTO statements.
Function returns.
Additional lines with GTO statements.

JEP Related Links Program pdf 