Guido Socher: homepage

Comparison between RPN and algebraic calculators

This is from a Nov 2012 posting on

Why do you, Slashdot users, like RPN?
I don't know that I can really articulate it, either, but I can report the results of an interesting experiment I participated in about 20 years ago.

I was an RPN-lover even then, having recently graduated from my 15C to a 28S, but most of the other geeks in the university computer lab where I spent a ridiculous amount of time couldn't see the sense in it. Late one night the discussion got somewhat heated and someone said that an advantage of RPN was that it was faster because it required fewer keystrokes. A measurable claim like that immediately sparked a demand for proof, so we decided to do some comparisons.

One guy got on the whiteboard and wrote down four very complex arithmetic expressions. Then for each expression, two candidates were selected, one from the RPN camp and one from the infix camp. Each was to write down on the board, under the expression, the series of keystrokes that would be needed to evaluate it. In all cases the RPN keystroke list was shorter, often considerably, but after the first was done everyone noticed a second interesting and unexpected outcome: The RPN-wielder finished writing down his keystroke list long before the infix-wielder -- and not just because of the number of keystrokes. Everyone watching noticed that the infix-proponent often paused for a second or two to think about how to handle the next bit, or stopped for a moment to go back to count up parentheses. In contrast, the RPN-er never paused, never hesitated, just wrote down keystrokes as fast as he could.

After that, we all decided that we should also time the remaining trials, which were all conducted with different candidates. The RPN user consistently finished 25% faster than the infix user, even though the keystroke list was only about 5% shorter.

Then someone (I think it was actually someone from the RPN camp) decided to write a truly horrendously complex expression. It had fractions nested at least ten layers deep and was, frankly, ridiculous. Two more stepped up to try and, once again, the RPN user wrote down keystrokes in a long list, without any more hesitation than it took to find his place in the expression. The infix guy, on the other hand got badly bogged down, backed up several times and ultimately gave up after his RPN competitor had been watching him struggle for five minutes.

To top it all off, actually punching all those keystrokes into real calculators showed that RPN was more accurate. On only one of the five problems was the RPN calculation not correct, while the infix calculation was incorrect on three out of five (determining which answers were correct took significant time and much arguing).

Bottom line, per our impromptu tests and my personal experience, RPN is faster and easier.

I could easily explain why it requires fewer keystrokes, but why exactly it requires less cognitive effort is harder to describe. I believe, though, that it's because when you use RPN you pick a "path" through the expression, and then just follow it. At each point along the path you only have to remember where you've been and where you're going. The calculator keeps track of the stack. With infix you have to manage the "stack" in your head, figuring out when to add and remove nesting levels with parentheses. That's not exactly right, but it's as close as I've been able to come.

--- swillden @ Why do you, Slashdot users, like RPN?
===End quote===

Back to Guido's RPN calculator page

© Guido Socher