HP 35 calculator 200 trick
In 1972 I bought the first HP 35 calculator sold on the Caltech campus. It was not by far the first one on the campus – HP had distributed pre-release copies to numerous faculty members. Max Delbrück, my next-door neighbor, had given me my first experience with the calculator one evening while hosting my landlady, her family, and me for dinner. I was smitten.
When the Caltech Bookstore posted the impending availability of the calculator I was the first on the list. The arrival date was not known, so I haunted the bookstore.
HP-35 (Source: https://commons.wikimedia.org/wiki/User:Mister_rf)
They finally came in sometime in November of 1972, if I remember correctly, and I happily paid the $395 price (about a quarter of my life savings at the time). It was everything I had dreamed of and more. It transformed my Physics lab performance from C (great on execution and writeup, not so hot on accuracy of calculation) to A. It made me popular as a member of study groups.
Games with HP 35
One of the things that we did was play games using the calculator. Geek games, of course. Typically this involved clever ways to calculate interesting results using the calculator’s capabilities in unusual or non-obvious ways.
For example, how to get as close to the value of pi as possible without pressing the symbol on the keyboard. (Hint: try 355 / 113).
One of my favorites, however, was how to get the number 200 into the display from a cleared calculator (zero in all four of the registers) without using any of the digit keys. I had discovered a remarkable six stroke way to do this that has not, so far as I know, been surpassed.
Getting to 200
The rest of this note will explain how this worked and what interesting things it reveals about the HP 35 implementation.
Here is the six-stroke trick:
- arc
- cos
- tan
- log
- ENTER
- +
If you try this on a modern scientific calculator, and even on one of the HP 35 simulators you can get for your smartphone or web browser, you will discover that the result is generally not 200.
What’s going on here?
The key to this is that the HP 35 was implemented on an early four-bit microprocessor. One of the decisions that the HP engineers made was to perform all calculations in decimal rather than in binary. While they sacrificed efficiency for the primary calculations, they also eliminated the need for expensive decimal-binary conversions on every input and a corresponding binary-decimal conversion on every result display. And since the calculator's performance was ultimately limited by the speed at which a person pressed buttons, keeping things in decimal made a lot of sense.
This led to some other interesting decisions. One of them was their representation of infinity, or overflow. Their simplification was to use the largest possible number, 9.999999999 x 1099 (9.999999999 E 99) or, basically, 10100.
For those perhaps less familiar with this particular terminology arc is a prefix key for the trigonometric functions (sin, cos, tan) and invokes the inverse function. So arc cos is the inverse cosine, more commonly rendered cos-1 (not 1/cos).
Those who recall trigonometry know that cos-1(0) yields 90 (degrees) or pi/2 (radians).
Now we apply the tangent function: tan(90). We know that the tangent function goes to infinity at pi/2, so what’s the point of this?
Aha – the largest number that the HP 35 could display is 10100 and the tangent function dutifully returns 9.999999999E99 (as close as I can render the calculator display).
That explains why the log function, the decimal logarithm, appears next in the algorithm. Because log(10100) returns the exponent, it produces 100.
And ENTER + simply doubles that result.
Voila! 200 in six keystrokes.
Comments
Post a Comment