Post Reply 
(RPL) percentage function % not preserving stack level 2
01-05-2019, 02:12 AM
Post: #5
RE: (RPL) percentage function % not preserving stack level 2
thanks very much all, that's most helpful.

(01-05-2019 12:53 AM)Joe Horn Wrote:  IMHO, Y was preserved in the 4-level RPN machines (after performing the % function) due to the very limited size of the stack. Since RPL machines have no such limitation, and since LASTARG returns both X and Y, there is no need for the function to preserve Y on the stack; the user is free to make as many copies as needed of any stack levels.

What is X plus Y%?
RPN: X ENTER Y % +
RPL: X DUP Y % +

I'd forgotten that LASTARG returns multiple args, that's useful, thanks.

The minor irritation with your RPL example above is that both DUP and % are hidden in different menus, so not as easy to type, e.g. it would be:
RPL: X TOOL-STACK-DUP Y MATH-REAL-%
which is a lot more button presses. I could use ALPHA-LS-1 for %, of course, but that's no less presses. Ah! But I can use Enter twice for DUP, OK, that's good Smile

(01-05-2019 01:13 AM)Albert Chan Wrote:  My guess is RPL tried to keep a consistent interface, returning 1 item for each operation.

RPN way implied consuming 2 items on the stack, then add back 2

It's ironic, in some ways, since RPL systems don't need to worry about consuming stack.

(01-05-2019 01:30 AM)rprosperi Wrote:  As others have noted, RPL tends to be more 'stack pure' while RPN did a lot of 'convenient', though non-standard, things which IMHO really did make them more useful. Returning dual results for % is the exact example I cite most when discussing this.

Note that %T is also very useful, though often not included in non-financial machines (but it is included in the 50g). The best way to do that in RPN is [1/X] [%] [1/X] as it is fast, and preserves the complete stack.

If that's the right order you want, OVER SWAP is faster. Took me a long time while learning stackrobatics to appreciate and think of using OVER; it helps more often than you might think.

Yes, I like %T too.

OVER SWAP: excellent! thank you Smile


again, thanks to all.

Cambridge, UK
41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot
Casio, Rockwell 18R
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (RPL) percentage function % not preserving stack level 2 - cdmackay - 01-05-2019 02:12 AM



User(s) browsing this thread: 1 Guest(s)