The best rummage sale purchase I ever made was a piece of hardware that used Reverse Polish Notation. I know what you’re thinking… RPN sounds like a sales gimmick and I got taken for a fool. But I assure you it’s not only real, but a true gem in the evolution of computing.

Sometime in the 1980s when I was a spotty teen, I picked up a calculator at a rummage sale. Protected by a smart plastic case, it was a pretty good condition Sinclair Scientific that turned out when I got it home to have 1975 date codes on its chips, and since anything with a Sinclair badge was worth having it became mine for a trifling amount of money. It had a set of corroded batteries that had damaged one of its terminals, but with the application of a bit of copper strip I had a working calculator.

And what a calculator! It didn’t have many buttons at a time when you judged how cool a scientific calculator was by the prolific nature of its keyboard. This one looked more akin to a run-of-the-mill arithmetic calculator, but had button modes for trigonometric functions and oddly an enter key rather than an equals sign. The handy sticker inside the case explained the mystery, this machine used so-called Reverse Polish Notation, or RPN. It spent several years on my bench before being reverently placed in a storage box of Sinclair curios which I’ve spent half a day turning the house over to find as I write this article.

I was reminded of my Sinclair Scientific recently when I read a Hackaday comment which introduced the inventor of RPN, Jan Łukasiewicz, as an engineer rather than a mathematician. I had not previously encountered him so this opened up a fascinating exploration of his work, plus a revisiting of RPN as an adult rather than as a soldering-iron-wielding teen. Simply put, RPN is a specific method of writing math equations that is still human while being suitable for input into a computer with limited memory.

The first thing to learn about RPN is that the “Polish” part comes from Łukasiewicz’s nationality. Perhaps we Anglophones should put in a bit of effort to learn how to pronounce his name. Then the second lesson is that the “Reverse” part is important, but a smokescreen that relates only to the direction in which it is written. Write the expression one way round and it’s Polish notation, the other way and it’s Reverse Polish notation.

The feature which makes PN and RPN special is that the operator does not come between operands, but follows them. So for example, where you might be used to writing ` 2+2= `

to get 4, in PN you would write ` + 2 2 `

, and in RPN you would write ` 2 2 + `

.

[Łukasiewicz] was a logician, and his notation was designed with the purpose of removing parentheses when each function has a constant number of arguments. Thus, we’re used to writing ` (2+2)*3 `

to get 12. In PN we write ` * 2 2 + 3 `

, and in RPN we write ` 2 2 + 3 * `

.

PN and RPN might be one of those slightly interesting mathematical factoids some of us in our community have heard about in passing some time in our education. But in fact is it much less obscure than that because RPN has a very useful property. It lends itself to use with a stack, to perform calculations. The operands and operator are in effect ready lined-up to be to be distinguished from each other by their order of precedence, meaning that a device such as a calculator could be produced more easily using RPN than conventional notation. While those of us who still use a physical calculator are used to conventional notation as an input, some earlier calculators used RPN to do more with less.

Which brings us back to my Sinclair Scientific mentioned above. When people think of an RPN calculator, it’s likely that they’ll single out Hewlett-Packard as a manufacturer. You can still buy an HP that uses RPN, and indeed not so long ago their adherence to RPN was considered a significant selling point by HP. But the Sinclair is a little different. Clive Sinclair always made a speciality of extracting the maximum performance from the minimum of components to deliver the lowest price, even if sometimes the quality or utility of his products suffered as a result.

This calculator then is a Sinclair product at its finest, featuring a cheap arithmetic calculator chip from Texas Instruments, the TMS0805, coaxed into offering trigonometric and logarithmic functions by some astounding coding from Sinclair employee Nigel Searle. The result was a single chip^{∗} scientific calculator at a fraction of the cost of those from TI or HP, but with the penalty of reduced speed and floating-point accuracy. We covered [Ken Shirriff]’s reverse engineering of a Sinclair Scientific a few years ago, even today it’s an intriguing machine.

In use it’s a frustrating exercise in learning RPN again on the fly, that turns into something close to a mathematical puzzle as the minutes tick by and that LED display drinks power from its 4 AAA batteries. That would have been no laughing matter in 1975, as a set of 4 alkaline AAAs would have been considerably more expensive in real terms than they are now. Once you are in the RPN Zone it really is extremely logical and easy to use, but the same can’t quite be said for the Sinclair. A complex sequence of keys is required for most of its functions, meaning that its novelty wears off after a while. Still, with early ’70s design aesthetic, at least it’s quite attractive to look at.

^{∗} Technically the Cambridge has 3 chips, the TMS0805 and a couple of display drivers. But they’re ancillary to the processor, and the HP calculator at the time used a 5-part processor chipset.

HP9100A image, the first Hewlett-Packard calculator to use RPN, Rama, [CC BY-SA 2.0].