Earlier quoted context omitted.
> It’s a much more intuitive way to do math Is it? It's easier to code an evaluator, but I'm not convinced it's necessarily more intuitive. In practice, only addition/subtraction and multiplication/division are ambiguous. I'll also play devil's advocate and admit order of precedence is somewhat arbitrary, and precedence of bitwise and and equality is wrong in most languages. Not sure why I'd want this: (flags & (4 ==…
Yes. It is. One difference is you see all intermediate results. That's huge for avoiding mistakes. In-fix, if you type (5+5)*(9+9), you only see the end result. Post-fix 5 5 + 9 9 + *, you see 10 and 18 along the way. Another is the stack lets you easily reuse subresults. If you've computed the total energy and want to use it three places, you pick it off of the stack. All your work is there. It's very common that th…
What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
101–110 of 118 posts
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#102Earlier quoted context omitted.
Yes. It is. One difference is you see all intermediate results. That's huge for avoiding mistakes. In-fix, if you type (5+5)*(9+9), you only see the end result. Post-fix 5 5 + 9 9 + *, you see 10 and 18 along the way. Another is the stack lets you easily reuse subresults. If you've computed the total energy and want to use it three places, you pick it off of the stack. All your work is there. It's very common that th…
Seeing intermediate values can’t be overstated. It’s a huge sanity check that catches many mistakes way earlier in the process.
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#103Earlier quoted context omitted.
RPN is so nice and efficient, can't imagine using anything else. I like that the OSX calculator does RPN. But mostly I use my old 28S which is next to my keyboard always. Also have a 50g on the desk, but I prefer the 28S.
I get annoyed by the ways the OS X calculator deviates from HP RPN. The main one is that the pi and e keys act as if they are invoking constant functions that return pi and e, respectively. On an HP calculator, the pi key enters pi. That may sound like the same thing, but it is not. Consider this sequence: 2 ln pi x On my HP 15C the result is to multiply the natural log of 2 and pi. Same thing with PCalc on my iPhone…
Admittedly I only use the OSX calc for very basic +-*/ operations. Anything more than that and I grab the 28S!
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#104Earlier quoted context omitted.
> It’s a much more intuitive way to do math Is it? It's easier to code an evaluator, but I'm not convinced it's necessarily more intuitive. In practice, only addition/subtraction and multiplication/division are ambiguous. I'll also play devil's advocate and admit order of precedence is somewhat arbitrary, and precedence of bitwise and and equality is wrong in most languages. Not sure why I'd want this: (flags & (4 ==…
Yes. It is. One difference is you see all intermediate results. That's huge for avoiding mistakes. In-fix, if you type (5+5)*(9+9), you only see the end result. Post-fix 5 5 + 9 9 + *, you see 10 and 18 along the way. Another is the stack lets you easily reuse subresults. If you've computed the total energy and want to use it three places, you pick it off of the stack. All your work is there. It's very common that th…
Only if in see-full-expression-before-action mode. Otherwise you would see 10 after the first ), and see 18 after the second ).
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#105Earlier quoted context omitted.
Reminds 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.
I 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.
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#106I like to repeat everywhere that HP48 series had code block syntax with arrow notation. 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.
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 .Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#107One 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.
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#108About 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.Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#109I 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!
> It’s a much more intuitive way to do math Is it? It's easier to code an evaluator, but I'm not convinced it's necessarily more intuitive. In practice, only addition/subtraction and multiplication/division are ambiguous. I'll also play devil's advocate and admit order of precedence is somewhat arbitrary, and precedence of bitwise and and equality is wrong in most languages. Not sure why I'd want this: (flags & (4 ==…
I would imagine if I were young today and started with a modern multi line calculator with textbook display then that is what I would be comfortable with but for folks born before 1980 or so the algebraic calculators of our time were error prone.
I have an HP 27S that is algebraic and breaks the mold of being error prone because it shows the whole expression up until the point where a part can be evaluated. Then it evaluates the inner part while still showing the rest of the expression.
Re: What Is RPN? Why Did/Does HP Use RPN? Learning RPN (1999)
#110Reading 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?
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.