News for hackers. Stuff that matters.
Re:UI is hell: four-function calculators by kqr on Friday January 24, 2025 @02:20AM (#42811194)
I realised reading this that, even though I used to be quite adept with these common four-function calculators, I have since forgotten most of their operation. The past ten years or so I have exclusively been using RPN calculators – I find them so much easier to work with, and going by this article, possibly even easier to implement sensibly?

(My main drivers are Emacs Calc on the computer and RealCalc on Android devices. For kitchen work I use a slide rule, which is something I think more people should do! There is nothing better for translating proportions.)

Re:UI is hell: four-function calculators by persnickety on Friday January 24, 2025 @02:40AM (#42811270)
RPN is definitely easier to implement. I helped someone do that as a student project and while it was minimally complex, there were no edge cases with the operators.

You pay for that by having a stack rather than a small fixed number of variables.

Re:UI is hell: four-function calculators by enriquto on Friday January 24, 2025 @04:01AM (#42811602)
> You pay for that by having a stack rather than a small fixed number of variables.

you can easily add variables to your rpn calculator. For example ">x" pops the top of the stack into the variable x, and "<x" pushes the value of x to the stack.

You can also interpret parentheses as whitespace to enable users to group parts of the computation (but this may become confusing when they write nonsensical parentheses).

Re:UI is hell: four-function calculators by ropejumper on Friday January 24, 2025 @04:23AM (#42811675)
They meant that the implementation of a four-function calculator only needs a few fixed variables rather than a stack.
Re:UI is hell: four-function calculators by _moof on Friday January 24, 2025 @03:06AM (#42811376)
My HP RPN calculator only has four positions available in its stack, which I imagine makes the implementation a bit simpler than a stack of arbitrary size.
Re:UI is hell: four-function calculators by persnickety on Friday January 24, 2025 @03:19AM (#42811436)
The typical 4-function calculator doesn't even allow multiple subtrees of computation, so I think it works out to having something like 2 entries on the stack.
Re:UI is hell: four-function calculators by tgv on Friday January 24, 2025 @02:50AM (#42811313)
Classical 4-func calcs are easier, I think. They don't even need a stack, just a place to store the previous value and the current input.
Re:UI is hell: four-function calculators by PeterStuer on Friday January 24, 2025 @05:15AM (#42811883)
In my youth my treasure was a HP41cv. I always found RPN far more logical, conceptually cleaner and as a result far simpler to use.
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @07:30AM (#42812478)
If you want a recreation:

https://www.swissmicros.com/product/dm41x

They also have their own versions of the 15c and so on. I have 3 different models (and one original HP RPN calc) and can confirm they are really high quality. Again though, spreadsheets are a lot more useful to me when I have more than just a simple calculation or two. I think these are mostly getting picked up by hobbyists, collectors, and those who work in labs and need a dedicated device with physical buttons.

Note that it doesn't have the big expansion pack things that I think the 41c came with if I'm thinking about the right calculator.

Re:UI is hell: four-function calculators by ghaff on Friday January 24, 2025 @08:17AM (#42812752)
I've been really tempted as my 41CV doesn't work any longer but I do real calculating so little that it would just be a nostalgia trip. (And I have a couple of the horizontal format HP calcs that still work for any of the calculator stuff I do sometimes do outside of an app.)
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @09:09AM (#42813168)
Yeah, for me it's mainly a hobbyist thing without much value at this point (probably better uses for my money). I'd love to have something like the 15c with a much bigger screen that does APL with physical buttons. Now that would be cool. I effectively have that on a tablet though (minus the dedicated system with physical buttons).
Re:UI is hell: four-function calculators by DarkSucker on Friday January 24, 2025 @02:50PM (#42816369)
That link made my day! Thank you. From what I read, their builds perform better than the originals, and they even make landscape versions. Woo hoo! RPN rules in my book. I picked up an HP 32 before they were gone forever, but I've been afraid to use it. It's great to know about SwissMicros; they'll get my business soon.
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @06:35PM (#42817992)
Not a problem.

I have their DM42 and it feels good in the hands. The case is solid metal too and the screen is nice. I believe the performance is better than the originals (not hard as some of these were sold before my birth and I'm not exactly a spring chicken anymore) and they fixed several bugs.

Re:UI is hell: four-function calculators by koblas on Friday January 24, 2025 @06:02AM (#42812049)
Plus, for owners of the HP41, if you had an essay question in your chemistry test you could type in cliff notes... Naw, I never did that.
Re:UI is hell: four-function calculators by PeterStuer on Friday January 24, 2025 @06:48AM (#42812232)
I did do that! But data entry was so laborious that by the time you entered the formulas you basically knew them by hard.
Re:UI is hell: four-function calculators by nottorp on Friday January 24, 2025 @07:24AM (#42812441)
A decent way to cram for an exam you don't care much about is to hand copy the course material too. You'll most likely end up retaining enough to pass.
Re:UI is hell: four-function calculators by genewitch on Friday January 24, 2025 @12:58PM (#42815614)
OK I always see this sentiment.

Can someone show something useful in RPN? House odds on 3 on roulette, or don't come odds for 10; or the standard deviation of 1, 1, 1, 1, 7, 29.

I have never seen anyone show an example more complex than 2 2 12 + * or whatever it looks like.

Re:UI is hell: four-function calculators by layer8 on Friday January 24, 2025 @06:53AM (#42812263)
Yes, RPN is easier to implement, and for the same reason also easier to reason about as a user,
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @07:25AM (#42812449)
I own several RPN calculators (they are very cool), but still find modern TI or Casio calculators to be superior now when I'm not using a spreadsheet or something like Mathematica.

Even 15 years ago, you could type out an entire equation that would have to be used multiple times and just update a single part of it and hit enter and then scroll up, modify, and hit enter again. All of that without having to resort to keystroke programming.

RPN is easier to reason about, but in aggregate doesn't save much time when you have a really slick modern interface and can scroll around and see things pretty printed. In engineering it is common to have some crazy looking things that are just easier to reason about when you can see it matches what is on the paper in front of you.

Re:UI is hell: four-function calculators by bruce343434 on Friday January 24, 2025 @11:25AM (#42814677)
> things [] are just easier to reason about when you can see it matches what is on the paper in front of you.

I have this sentiment every time I dive into some "other" programming math notation. Such as (lisp), rpn, infix without precedence, etc. In theory I like it, but then in practice it's just kind of painful.

We humans are entrenched in our bad but default notation!

Re:UI is hell: four-function calculators by roelschroeven on Friday January 24, 2025 @11:45AM (#42814879)
Is infix notation even that bad?

I guess RPN has advantages for use as an input method for calculators, but as an actual algebraic notation? It seems to me it's very cumbersome to perform standard algebra on equations in RPN notation (or prefix notation, for that matter).

I can't be sure but as far as I know nobody has using anything other than infix for algebra. Every time I see a text explaining the advantages of RPN, it's always in the context of calculator input.

Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @11:48AM (#42814919)
There are disadvantages to RPN as well. I read a book on the Forth programming language (also uses RPN) and some calculations that are algebraically simple require pretty bizarre stack shuffling with RPN stacks. I wish I had the source example. It was something pretty standard in a highschool algebra book like the midpoint formula or something like that. The reverse might be true as well in some situations, but I can't recall any examples outside of RPN's historical advantage against old TI calcs in the 80s. Maybe a forth or RPN enthusiast could help.
Re:UI is hell: four-function calculators by kstrauser on Friday January 24, 2025 @11:29AM (#42814716)
I have an HP 50g that makes it easy to flip between RPN and textbook-style graphical equations where you can arrow around and tweak any value. You can have both approaches in the same place.
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @11:45AM (#42814881)
Agreed, but the 50g is ancient and is the only calculator to my knowledge that has that capability.

For the most part the options are an older style RPN calculator (even the super nice swiss micros don't have equation scroll, although you can at least see the contents of the stack on the screen like the later HP calcs could), or what TI and Casio have.

Re:UI is hell: four-function calculators by wtallis on Friday January 24, 2025 @05:34PM (#42817581)
The whole 48/49/50 series covering 1990–2015 has that equation writer functionality, or in other words: every RPN graphing calculator.
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @06:42PM (#42818028)
Good point.

Still a niche within a though. They weren't that common in the wild like the old HPs were. I knew someone in the engineering program at Texas Tech with a 50g, but never saw a single engineer or stem major at my school with one. They had them in production for awhile, so they're out there (logically speaking), but they've got to be a big outlier.

Re:UI is hell: four-function calculators by billmcneale on Friday January 24, 2025 @01:06PM (#42815664)
I used to be in love with RPN and owned multiple HP calculators (HP-41, HP-15) but RPN is cheating by offloading effort on the user.

When you see a complicated, parenthesized expression, it's up to you to figure out the deepest expression, enter it first, and then work your way out.

Standard calculators require more keystrokes but they can be entered without much thought, left to right. And these days, you can also edit and modify your input, so it's hard to justify RPN.

Re:UI is hell: four-function calculators by kccqzy on Friday January 24, 2025 @01:16PM (#42815736)
Why would you need to enter the deepest expression first?
Re:UI is hell: four-function calculators by 7thaccount on Friday January 24, 2025 @02:18PM (#42816152)
I think they mean that for a complicated expression you have to spend more brain power figuring out how to input things with RPN. It is a little more common sense with infix.
Re:UI is hell: four-function calculators by billmcneale on Friday January 24, 2025 @04:22PM (#42817040)
Yes, exactly.

If you have

1 + (2 * 3 + (4 / 5))

The smallest key count with RPN is to start entering the deepest expression first:

4 ^ 5 / 2 ^ 3 * + 1 +

You can type it left to right but it takes more keys and is probably on par with standard paren arithmetic, which negates the RPN advantage

1 ^ 2 ^ 3 * 4 ^ 5 / + +

Re:UI is hell: four-function calculators by benhurmarcel on Saturday January 25, 2025 @08:26AM (#42821512)
I’ve been thinking that an RPN calculator app could easily display the full natural expression while you enter it in RPN. And let you modify it afterwards.

I haven’t found such an interface yet.

Re:UI is hell: four-function calculators by Kim_Bruning on Friday January 24, 2025 @08:11AM (#42812713)
Do you also use dc? (can be used on terminal / termux)

https://linux.die.net/man/1/dc

Re:UI is hell: four-function calculators by kqr on Friday January 24, 2025 @08:30AM (#42812832)
Yes, but mainly in scripts and oneliners (never learned the Bash arithmetic substitution thing). For interactive use I often have a shorter time-to-arrival to either Emacs or RealCalc.
Re:UI is hell: four-function calculators by taeric on Friday January 24, 2025 @12:25PM (#42815323)
I'm super intrigued on the slide rule idea! Where did you get one and what sort of stuff do you typically do with it?
Re:UI is hell: four-function calculators by alexjm on Friday January 24, 2025 @01:44PM (#42815920)
I have a kitchen slide that I use for ratios in recipes. It's an old plastic one from Think Geek.

For example, I usually put 15 grams of coffee with 8 oz of water (please excuse the mixed units). To make a different amount, I align the 1.5 on the top rule with the 8 on the bottom rule to set the ratio. Then each number on the top rule (coffee in grams) matches the scaled value on the bottom rule (water in oz). The 6 on the bottom rule aligns with ~1.1 on the top, meaning I should brew my little six-ounce cup with 11g of coffee. In practice, I do this a lot with bread, but the "baker's percent" convention for writing bread recipes makes it a more complicated example.

Another way to use a kitchen slide rule is when scaling a recipe. Say I want to make 2/3 of a batch of cookies. I line up the 3 on top with the 2 on the bottom. Then for each ingredient, I find the recipe's quantity on top, and read off the scaled quantity on the bottom. This works better with recipes that use weights, to avoid awkward fractions or converting between units so you can subdivide.

Re:UI is hell: four-function calculators by kibwen on Friday January 24, 2025 @12:33PM (#42815410)
Agreed, my spicy take is operator precedence was a mistake that we regrettably inherited from mathematical notation. Parentheses for grouping are fine, at least.