10 ms·
What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
- agumonkey 6y agoI like to repeat everywhere that HP48 series had code block syntax with arrow notation. << a -> a a + >> (double function) Those machines were well before their time.. I hope the makers had fun, it's really sad it's gone from the market although one could say that ES6 in your smartphone browser is your modern day HP48 reincarnation.
- mssundaram 6y agoMy grandfather was a civil engineer and he had a number of different RPN HP calculators. He gave them to me when I was becoming interested in programming - a really exciting gift to explore.
- madengr 6y agoDo you still have them? Back in the 90’s when HP was discontinuing them, I bought 4x 32sii. I still have them un-opened. I still have my dads LED one from the 70’s. They are collectors items now.
- ghaff 6y agoAnd the LED ones had relatively short battery life; they were rechargeable. When I started college, HP calculators were still very expensive so I started with a TI. Within a year or two, you could get an HP LED model (HP-55 in my case) for a reasonable price. Through college I still took a slide rule to exams as a backup in case the battery died for some reason though I never had to use it. During the latter part of the 70s, calculators were dropping in price extremely rapidly.
- MaxBarraclough 6y agoHere's my take on the Forth equivalent. Defining a DOUBLE word, the usual way, rather than anonymously. (Tricky to pick a good identifier that doesn't sound like it's doing something with double-precision floats.) ( num -- num_doubled ) : DOUBLE DUP + ; Next up, we push 7 to the stack, define our 'function' (not a Forth term) anonymously using :NONAME which pushes an execution token value to the stack, then we immediately invoke it. This has the effect of printing 14. 7 :NONAME DUP + ; EXECUTE .
- MaxBarraclough 6y agoToo late to edit: the second example leaks memory, as the execution token is not destroyed before becoming inaccessible. As far as I know, ANS Forth doesn't offer a friendly interface for destroying execution tokens.
- bestham 6y agoEvery time I end up on a non-rpn calculator I struggle to convert the calculation I have in my head to use infix operators.
- hamburglar 6y agoSame here. I can’t really tell if it’s bias because I am very comfortable with RPN, but another of the benefits of RPN is that it seems much easier to build up a complex computation on the fly without having to backtrack and add parentheses, which on most calculators means you have to start over. With an infix calculator, I have to plan the whole thing out precisely before I even begin entering it, whereas RPN feels like a “streaming” translation that is very easy.
- dev_tty01 6y agoI can hardly use a non-RPN calculator. Wonderfully efficient for both simple and complex calculations.
- rbanffy 6y agoIt's simpler to implement RPN than algebraic notation with precedence. The latter requires an operation stack where operations are stacked until they encounter a lower precedence operator or the user presses =. The user types less, the computer does a lot less. I find it fun to think in RPN.
- jeffbee 6y agoYeah, it feels like the whole "why" is that RPN reflects how the machine works, so it's easier to build it that way.
- ajarmst 6y agoWell, it’s easier to build because it has a terse syntax that requires fewer symbols, doesn’t need precedence and associativity rules, and has no ambiguous instructions. It’s easier to use for the same reasons.
- tome 6y ago> has no ambiguous instructions Really? What do you call an operator applied to an empty stack? A sequence of commands that leaves the stack non-empty? I don't see why that's any less ambiguous than mismatched parentheses.
- jeffbee 6y agoWhy would any person or machine care that the stack wasn't empty?
- jonsen 6y agoAnd there is actually no such thing as an empty stack on an RPN calculator. A four register stack, as is common, always holds four numbers.
- jonsen 6y ago> A sequence of commands that leaves the stack non-empty? That’s actually a feature. It’s even fundamental in concatenative programming languages such as FORTH and Factor.
- gumby 6y agoThis is an odd explanation. II mean I t may be factually correct but has nothing to do with why people choose to use RPN calculators. When calculating with an RPN calculator you do the calculation the same way you would by hand: “ok, figugpre out the numerator, now calculate the denominator, ok, do the division, ok now there’s a product, so do the multiplication, now add it to that fraction I just calculated...” except you don’t need to write down the partial results. Not only is it fewer keystrokes and parentheses and such, but as you’re doing it as you naturally would anyway you’re less likely to get lost.
- disabled 6y agoIt took awhile to learn RPN in undergrad in electrical engineering. But, once you learn it, it is so much easier to solve problems and it is much more efficient. You never go back, and you are less likely to make errors entering in equations compared to your peers. This is important on timed exams. I prefer to always use RPN. MacOS has an RPN mode on their calculator, which one can activate by pressing command + R. On my iPhone I have an app called i41CX+, which is an HP-41CX emulator. I highly recommend the app, as the developer is constantly updating it. It probably is the most updated app I have of all of my apps. Also apparently there are some companies that recreate old HP RPN scientific calculators: https://www.swissmicros.com/products https://www.swissmicros.com/products
- pwg 6y agoMy 'desktop' calculator on my Linux machines: http://lashwhip.com/grpn.html http://lashwhip.com/grpn.html (yes, I know that xcalc has an HP mode, but I only learned of that mode long after I'd begun using GPRN. The calculator on my Android phone (I 'disabled' the maker installed one): https://play.google.com/store/apps/details?id=org.efalk.rpncalc&hl=en_US&gl=US https://play.google.com/store/apps/details?id=org.efalk.rpnc... And I've still got my original 80's HP-15C.
- ajsnigrutin 6y agoyep, rpn is great! And since you're solving part by part, it's easier to spot mistakes in calculations. Going back to algebraic is pretty much impossible... luckily, there are many rpn calculator apps for phones.
- senkora 6y agoEmacs calc-mode is RPN by default as well.
- tonyarkles 6y agocalc-mode is wholly responsible for my HP49G+ not having had its batteries replaced in a few years. :D
- ghaff 6y ago
- ADSSDA 6y agoI went through all of high school and college with an HP48 calculator. I can't express how much more natural RPN felt than the more traditional alternative (and fast!). It also made for very confused expressions whenever anyone borrowed my calculator...
- Animats 6y agoI have an original HP-11C on my desk. It's about 30 years old, works perfectly, and I've had to replace the batteries about once a decade.
- fifilura 6y agoI also keep my HP32S RPN from 25 years ago on my desk still. The combination of HP quality build and RPN. Not a chance that I would have allowed anything less waste my desk space
- aseerdbnarng 6y agoI was forced to use an HP12C as part of my university degree. Once you get used to RPN it’s quite uncomfortable to switch back. It’s a much more intuitive way to do math once you get over the small hurdle. 15 years later and I’m still using the same calculator!
- madengr 6y agoYep, had my Radio Shack calculator stolen from a college lab in 1990. Replaced it with a 32sii. After 30 years of RPN, I can never use a normal calculator. They are horrible.
- imglorp 6y agoWe had plug-and-chug competitions at school: big equations with some inputs, ready, go. The HP RPN folks would always beat the algebraic (casio, TI, etc) ones.
- SavantIdiot 6y agoI bought an HP48 in 1990 junior year in college when it came out. A calculator WAS required for engineering school, but this one made everything way easier. I think it was almost $200. Anyway, once you go RPN, you don't go back. It makes way more sense. It finally died 5 years ago: the keys stopped working. I read about how to repair the keypad but finally had to let go. I had all my crib sheets from engineering school stuffed into the pouch. That calculator was epic. I can't imagine trying to do complex math with a slide rule, even though that's how engineers had done it for ages.
- lloeki 6y agoSimilar story. Got a 48GX in high school. Everyone had TI89, maybe TI-92. I was the only one with HP. Even with its lowly Saturn CPU and perceptually slower, it was trouncing the TIs at basically every task, especially when you customised it. I learned RPN and RPL alright, but also got to dive into System RPL: the low level, faster, much more rich RPL, but where every argument was basically unchecked as it was more like HP-provided ASM routines in disguise. And then learned to bit-bang stuff on the screen in assembly with all the timing tricks to produce 4 grayscale instead of just black/white. Great for coding small games. Got the the third party CAS algebra extension card that also replaced the original UI for the same thing, only faster and better, and with a much more potent symbolic solver, whose UI was absolutely glorious to write, select, navigate, and perform advanced stuff. Also got a maxed out storage expansion for the second slot. Such storage was not solid state so it required a continuously operating CR2032 battery to persist over time. Unfortunately, as robust as it was, some time after engineering school it took a hard fall too much and was irreparably broken. Later got my hand on a HP49G+, ARM powered but surprisingly the default was to run an emulation of the Saturn CPU, and CAS was bundled. You could still code for the ARM one though. By that time I lost interest so it currently sits in a drawer. Also preferred the 48 boxy design, especially the mushy keys of the new one were way worse.
- m463 6y agoReading these comments, I'm surprised that people think in RPN. (I mean I shouldn't be, I just didn't think of it) I wonder if teaching it early on, instead of parenthesis, would have made math lessons different? Could there have been different notations used for things like factoring out a quadratic equation?
- leejoramo 6y agoI learned RPN as a college freshman studying engineering in the late 1980's. Almost all of my fellow students had HP RPN calculators. Once we where doing more advanced math RPN -- with the accompanying stack -- became so much easier to enter. We all quickly learned it and I think most of us came to hate standard calculators.
- 082349872349872 6y agoEven algebraic has different also-possibles. APL and Smalltalk don't bother with precedence, for example.
- fsckboy 6y ago> Could there have been different notations used for things like factoring out a quadratic equation? well, you're talking about high school algebra, but just adjacent to that is the lisp programming language which uses polish notation. It also uses parentheses because parsing the parentheses-less polish notation requires that the operators have a fixed number of operands Sussman, co author of SICP and co creator of lisp-like Scheme, has a current idea/book/project he's advocating which is to teach physics using scheme instead of algebraic-calculus because the notation is more precise: rather than differential equations which you need to be skilled at reading, you use polish notation computer programs that can be executed and studied.
- m463 6y agoWell. just. wow. I was just thinking of notation, but making math parsable, or teaching a regular math notation, that should be a thing. I remember hearing generalizations like "chess is pattern matching", and "math is just symbol manipulation", but latter really comes to life if we make math notation regular enough to be funamentally machine readable. Just think what it could do with ai (or for ai)
- blue1 6y agoIs there a good RPN calculator currently? The HP Prime is lacking apparently, and the 50G is no longer available (and a bit old)
- irateswami 6y agoA 35s and 50g got me through my engineering degree, I'm sure they'll still work fine.
- joeyo 6y agoThe DM41X and DM42: https://www.swissmicros.com/products https://www.swissmicros.com/products
- linguae 6y agoI don't own one, but I've heard great things about SwissMicros calculators (https://www.swissmicros.com/products https://www.swissmicros.com/products) from users of HP calculators. The SwissMicros lineup is very similar to HP's 1980s calculator lineup. Also, the HP 12c financial calculator and the HP 35S scientific calculator are still being sold by HP.
- neeasade 6y agooh shoot, I missed this comment elsewhere in the thread -- just want to say I got their HP15C equivalent years ago and it's high quality.
- Noe2097 6y agoThe HP Prime does have an RPN mode. I bought it recently, for that very feature, when my HP48 died. The keyboard of the HP Prime isn't really optimized for it (some trivial operations on the stack require key combinations, while on the HP48 there were physical keys for them), but it's acceptable.
- jtwaleson 6y agoI have the Droid48 app on my android phone. Pretty nice but I actually never use it.
- teej 6y agoThe article briefly mentions RPL. It’s a programming language for Hewlett-Packard RPN calculators. It’s an interesting curiosity if you’re in to niche programming languages. https://en.wikipedia.org/wiki/RPL_(programming_language) https://en.wikipedia.org/wiki/RPL_(programming_language)
- dano 6y agoMy personal collection of HP's from back in the day. All are operational and I have the original manuals from a few. https://photos.app.goo.gl/McLDSnm5ksaRQhSJA https://photos.app.goo.gl/McLDSnm5ksaRQhSJA
- sli 6y agoLove my HP50G. I rode a motorcycle during college, so consequentially I always had my HP50G on me wherever I went since I never took it out of my backpack.
- Klwohu 6y agoRPN is just so much better. An interesting note, the HP 50g can be programmed in RPL, but you can also use the equation editor and mix and match code and equations.
- pcardoso 6y agoWhen I was starting my degree (around 96) I went to the US for a week and bought a HP48Gx since they were cheaper there. This happened a few weeks after a Swiss jet crashed departing NY and the reasons were not known at the time so the airport staff was very suspicious. When they saw the calculator and tried to do a simple test calculation and failed, I struggled to explain how use it, since it was also so new to me. Luckily I got 2 out of 1 1 + and I was let go... still have and love it.
- macintux 6y agoReminds me of the story of someone who took a Linux laptop through security; they wanted to see it boot, but didn't recognize the command line and were suspicious. The owner set PS1 to resemble a DOS shell prompt and they were satisfied.
- dehrmann 6y agoI remember flying with a bunch of hard drives out of SFO in 2002. I was a little worried security would get 9/11 worried about them. Maybe because it was SFO are are used to seeing tech people flying with odd stuff, they didn't care.
- lozaning 6y agoI worked in Mountain View and lived in Palm Springs for a while and used to commute back and forth through SFO/PSP. Im convinced you could take damn near anything through SFO tech wise, cause they've seen it all. Meanwhile explaining to the TSA people in Palm Springs why I've got 3 laptops, let alone 4 dozen cell phones was always a hassle and a half.
- KineticLensman 6y agoI flew into SFO in approx 1990 with some 3.5 inch floppy disks. The customs guy had to ask me what they were.
- dheera 6y agoHP48GX was the best calculator ever. I used one throughout my middle/high school. The best features, IMO, were (0) the IR emitter and (1) the ability to program it to switch ON at a specified time and run code. This means I could hide my calculator somewhere in a room before class started and program it to turn on halfway through class, turn the classroom TV on, turn the volume to max, and start wildly flipping to random channels. One teacher had all of us students put our hands up and walked around the room looking for who had a remote at their desk, and I remember watching that teacher's face of horror when the TV continued flipping channels as everyone had their hands up.
- anonymousiam 6y agoI bought an HP41C in 1979, and I have been a fan of RPN ever since. I tossed the 41C back when I got my first Palm HPC and installed the "RealCalc" app. I'm glad that some of the modern calculator apps still support this mode.
- kuon 6y agoRPN is a lot like vim, the first time you are like DUH! I can't add 2 and 2. But if you take the learning curve, it becomes very efficient and you cannot move back.
- spullara 6y agoI did so much programming on the HP 28S and the HP 48Gx. Really an awesome mobile programming platform at the time.
- u801e 6y agoI still have my HP 48g and I prefer using the dc[1] for calculations on my laptop. [1] https://linux.die.net/man/1/dc https://linux.die.net/man/1/dc
- every 6y agoI do my taxes every year in dc...
- jonsen 6y agoAlgorithms for RPN Calculators by John A. Ball (1978) landed in my mailbox two days ago. It’s each and every detail you can imagine regarding RPN. Very well and thoruogh written. A great pleasure to study it: https://www.amazon.com/Algorithms-RPN-calculators-John-Ball/dp/0471030708/ https://www.amazon.com/Algorithms-RPN-calculators-John-Ball/...
- bitwize 6y agoThere's an open-source Android app called Droid48 that gives you a virtual HP48, if you're into that sort of thing. I know when I'm out with coworkers and they whip out Droid48 to calculate the tip, I picked a good place to work.
- abawany 6y agoFor ios, I've used Free42 and i48 (Daniel Parnell).
- GilbertErik 6y agoI've had a decent experience using RealCalc Plus, although it's just my backup when I don't have my 32SII handy.
- prionassembly 6y agoSee also: https://medium.com/@hlship/confessions-of-a-threading-macro-addict-5a026dae4af7 https://medium.com/@hlship/confessions-of-a-threading-macro-...
- abhinav22 6y agoI have a very successful (and free) rpn calculator for iPhone for those interested: https://apps.apple.com/ae/app/rpn-30/id1451413517 https://apps.apple.com/ae/app/rpn-30/id1451413517
- jerhewet 6y agoNo mention of Forth? Back in the early 80's Forth was the first language available on the original Macintosh. I loved Forth, but it completely ruins you for every other non-RPN language. I remember writing an ASCII terminal (dial-up modem) application in Forth to learn the language, and afterwards every other language that I was using at the time just looked... weird. I had to perform a massive mental shift to get back into all of the other languages I was being paid to work with at the time, and it was so difficult (for me, anway) that I never went back to it.
- kragen 6y agoDo you have an example of what you'd consider typical, boring Forth code? I was trying to compare programming styles in different languages the other day by looking at different pieces of randomly selected code, on the theory that most code is probably pretty typical. So, for example, for JS I used the bisect_by function from Crossfilter2, and for Perl I used Net::DBus::Binding::Message::Error::new. Unfortunately, all the Forth I had on hand or could easily find was one of ⓐ something I'd written myself, ⓑ something written for didactic purposes or as an example of the ideal way to do things, or ⓒ by the author of the Forth implementation it runs on. I'd argue that all of these are likely to be atypical examples of Forth style.
- icedchai 6y agoI had an HP48SX in high school, back in 1991 or so. I upgraded to an HP48GX in 93, I think? I remember writing a couple of games in RPL during physics class. And cheating on chemistry tests.
- neeasade 6y agohey all -- if anyone is looking for a modern hp calc lineup equivalent, I've been super satisfied with the HP15c clone I got from https://www.swissmicros.com/products https://www.swissmicros.com/products a few years back. I was rather disappointed with the 2013 HP15c limited edition re-release. Hope this throws anyone feeling looking for something in $current_year on the right track.
- kragen 6y agoI've been experimenting with RPN user interfaces for a while; https://asciinema.org/a/391001 https://asciinema.org/a/391001 is a screencast of a recent prototype that uses the terminal and builds up an infix representation of the expression that generated a given result. http://canonical.org/~kragen/sw/dev3/rpn-edit#50_iota_2_ln_*_exp_11_iota_1_+_11_iota_2_+_*_2_/ http://canonical.org/~kragen/sw/dev3/rpn-edit#50_iota_2_ln_*... is an earlier prototype that runs in the browser. I don't think RPN is a super great fit for multitouch screens but it works really well for keyboard interfaces.
- userbinator 6y agoAnother advantage to RPN is consistency between machines. Early algebraic models had differing limits of the complexity of the expressions they could evaluate. Even RPN has a limit, that being the stack depth --- while most of HP's calculators had 4, the HP48 has one limited only by available memory.
- ryebit 6y agoI've had the Droid48 app on my android phone for years. It's a little unstable, hope author updates it. But it's so awesome to have a 48GX available whenever, while my real one sits safely on the shelf at home. When I first got that thing as kid, nearly returned it, RPN seemed so bizarre. So glad I didn't... Really love that language, would never have understood stack based VMs as deeply if it weren't for the things I coded on that calculator. Droid48 - https://play.google.com/store/apps/details?id=org.ab.x48&hl=en_US&gl=US https://play.google.com/store/apps/details?id=org.ab.x48&hl=...
- JoeDaDude 6y agoThe only reason I don't use my HP-15c scientific, which I got in college well before the turn of the century as an EE undergrad, is because it has been emulated on my phone. Well worth the price: https://apps.apple.com/us/app/hp-15c-calculator/id503720774 https://apps.apple.com/us/app/hp-15c-calculator/id503720774 And oh, BTW, I still have my 15c.
- Scott_Sanderson 6y agoPicked up an HP calculator to take the FE exam. The other approved calculators were simple 4 functions calcs. I assumed everyone would be on the HP but I was the only one who had one at the testing center.
- ece 6y agoI got an HP48G in high school for UIL[1] competitions at the direction of a math teacher, and once I got the hang of it, it's been hard to use anything else. The competitions were a mix of math and seeing how many problems you could go through in 30 mins using a calculator. Pretty fun once you get the hang of it, and the HP48G/RPN did give me more time on non-numerical problems. The IrDA is finicky, but the programming and builtin features are great. The feature set is a bit much for a high school student maybe, but I used it through all of college too. I probably played a bit more minesweeper on it than I should have. The HP prime and Droid48 apps are nice, but I just don't need calculators as much anymore. [1] https://www.uiltexas.org/academics/stem/calculator-applications https://www.uiltexas.org/academics/stem/calculator-applicati...
- kelchm 6y agoI used an HP 50g in high school — I always loved the look of confusion after someone asked to borrow my calculator.
- CodeWriter23 6y agoI never had much love for RPN until recently when I found myself hand coding PostScript. I loved the minimalism of leaving a result of one operation on top of the stack and feeding it into subsequent operations. I totally want to learn Forth now.
- dreamcompiler 6y agoForth and Postscript are RPN computer languages that you can program in directly. (Likewise the JVM instruction set but most users don't program it directly or add new instructions.) Lisp is FPN ("Forward" Polish Notation). One reason Lisp needs parentheses while Forth doesn't is that Lisp allows a variable number of arguments to functions; Forth generally does not. It's possible to build variadic Forth functions but you have to push the number of arguments as a parameter, which is usually not very convenient. With Lisp, the closing parenthesis delimits the last argument so the Lisp compiler always knows how many arguments were passed automatically. Polish notation makes both Forth and Lisp very easy to parse compared to algebraic languages, and as the article points out it also makes expressing function composition very easy in both.
- mmcgaha 6y agoI have 14 RPN and 7 algebraic calculators, so you can say that I prefer RPN 2 to 1 over algebraic models. About 15 years ago, I was gifted a 1986 12C by our cost accountant. This thing was beat up, missing the badge, and generally nasty; given that and the fact that it is a financial calculator made it pretty much ignorable. Over the years, the batteries would die in my other calculators and I would reach for that 12C more and more. Eventually the 12C became my main desktop four-banger. Now main did not mean only because I need something to convert between dec and hex, so I also have a TI-36x solar on my desk. Don't get me wrong, I am a huge fan of the early 90s incarnation of the 36x but I really don't want two calculators on my desk. So last night after reading this thread I was inspired to use some of the programmable features of my 12C and write decimal/hexadecimal conversion routines. And here are the routines: DEC -> HEX: GTO 00 Input integer 0-255 Result format is nibble.nibble e.g. 10.15 = AF 12.05 = C5 HEX -> DEC: GTO 15 Input format is nibble.nibble e.g. enter 14.13 = ED 1.11 = 1B Result is an integer 01 16 03 / 04 DUP 05 INTG 06 SWAP 07 FRAC 08 .16 11 * 12 + 13 GTO 00 14 R/S 15 DUP 16 INTG 17 16 19 * 20 SWAP 21 FRAC 22 100 25 * 26 + 27 GTO 14 Now this formerly disrespected lowly financial calculator has grown to be not only my favorite four-banger but now the only calculator I will ever need at my desk.
- todd8 6y agoI was first exposed to RPN around 1963. It was a game my aunt gave me as a present. I wish I could remember the name of the game. Players rolled dice that had logical operators and perhaps quantifiers on the faces of the dice. The goal was to construct valid logical expressions using RPN. Even for a kid that was nuts about math, the game wasn’t that interesting. Does anyone remember what I’m talking about? I’m not sure of the year, but I think there might have been ads for the game in the magazines I read, like Popular Electronics or Scientific American.
- alan-crowe 6y agoWas it WFF 'N Proof? https://en.wikipedia.org/wiki/WFF_%27N_PROOF https://en.wikipedia.org/wiki/WFF_%27N_PROOF
- todd8 6y agoYes, it was! Thanks so much, I just couldn't remember the name of that game. How did you recall it from over half a century ago? Looking up used editions of WFF'N Proof on Amazon I recognize the instruction book published in 1965. That must have been around the time I received the game. It looks like more recent sets were more extensive. Well, the game likely had a positive influence on me, I ended up with a Math degree in college. Even in high school, I understood logic and proofs better than the other kids in my school.