(RPL) percentage function % not preserving stack level 2
|
01-05-2019, 12:18 AM
Post: #1
|
|||
|
|||
(RPL) percentage function % not preserving stack level 2
Having recently discovered the joys of percentage functions: % and Δ%/%CH on 15C
& 42S (and WP 34S), after years of doing them manually on other calculators or in my head, I went looking for them on my 50g. I'm surprised to find that, there, they don't preserve level 2 of the stack in the way that on earlier calculators they preserved Y, which can be quite useful. Of course, it's nothing that can't be done manually, or I could assign ≪ SWAP DUP ROT % ≫ to a key/menu (or something more clever, once I work it out). But am I missing something? If not, any idea why this changed, with the RPL calculators, compare to e.g. 15C/42S? thanks very much… Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-05-2019, 12:53 AM
(This post was last modified: 01-05-2019 12:55 AM by Joe Horn.)
Post: #2
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
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 % + <0|ɸ|0> -Joe- |
|||
01-05-2019, 01:13 AM
Post: #3
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
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 |
|||
01-05-2019, 01:30 AM
Post: #4
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-05-2019 12:18 AM)cdmackay Wrote: Having recently discovered the joys of percentage functions: % and Δ%/%CH on 15C 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. (01-05-2019 12:18 AM)cdmackay Wrote: Of course, it's nothing that can't be done manually, or I could assignIf 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. --Bob Prosperi |
|||
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. 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 (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. 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. Yes, I like %T too. OVER SWAP: excellent! thank you 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/C47 Casio, Rockwell 18R |
|||
01-05-2019, 02:44 PM
Post: #6
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-05-2019 02:12 AM)cdmackay Wrote: 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: Of course, you can use custom menus or the user keyboard if you use those commands often. But, yeah, using RPL machines involves a lot of hunting and pecking in menus. |
|||
01-05-2019, 08:25 PM
Post: #7
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-05-2019 02:44 PM)John Keith Wrote: Of course, you can use custom menus or the user keyboard if you use those commands often. But, yeah, using RPL machines involves a lot of hunting and pecking in menus. yup, I suppose it's unavoidable given the scope of available commands etc. Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-06-2019, 01:26 AM
(This post was last modified: 01-06-2019 01:54 AM by RMollov.)
Post: #8
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-05-2019 02:12 AM)cdmackay Wrote: 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: DUP end ENTER do the same here. No double ENTER is needed. For the above example you do: X [ENTER] Y [MTH] [REAL] and now you have all % related commands available after two easy to remember keystrokes. (I personally would do: X [SPC] Y [MTH] [REAL] and then %whatever...) BTW on HP50 prof. Rautenberg's KEYMAN would let you assign REAL menu as a 'longhold' of MTH key in case you use it often. Cheers, |
|||
01-06-2019, 03:48 AM
Post: #9
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-06-2019 01:26 AM)RMollov Wrote: DUP end ENTER do the same here. No double ENTER is needed. For the above example you do: Thanks, but the point of the DUP (or double ENTER) was to preserve the first number entered, as occurs on RPN calculators like the 15C, 42S, etc. That was the main point of my question. However, ANS/LASTARG is better still, in some cases. I've been meaning to look into KEYMAN, thanks for the reminder. Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-06-2019, 06:16 AM
Post: #10
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-06-2019 03:48 AM)cdmackay Wrote: Thanks, but the point of the DUP (or double ENTER) was to preserve the first number DUP is not double ENTER, it is just another name for a single ENTER. Not a big deal to hit it quickly twice IMHO the RPN implementation of those %-functions is better done (more consistent) in RPL. LASTARG loads both operands in the stack pushing previous result up, which is AFAIC the desired way of doing it; with RPN you have first operand in Y - visible, the second in L - invisible and result in X. [X<>Y] & [LastX] (3 keystrokes) will be needed to mimic what LASTARG achieves with 2. On the other hand I have no clue how and what for you use them, so my views may not be applicable in your case, just sharing ideas. Cheers, |
|||
01-06-2019, 10:48 AM
(This post was last modified: 01-06-2019 10:50 AM by Joe Horn.)
Post: #11
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-06-2019 06:16 AM)RMollov Wrote:(01-06-2019 03:48 AM)cdmackay Wrote: Thanks, but the point of the DUP (or double ENTER) was to preserve the first number cdmackay: No, that's not correct. During digit entry, one DUP in RPL has the same effect as a double ENTER in RPL, and has a different effect than a single ENTER, as can be seen in these RPL keystroke sequences: CLEAR 5 DUP 6 % + --> 5.3 alone on stack CLEAR 5 ENTER ENTER 6 % + --> 5.3 alone on stack [One DUP has same effect as two ENTERs] CLEAR 5 ENTER 6 % + --> Error: Too Few Arguments [One ENTER fails] Reason: RPL's ENTER *either* terminates numeric entry *or* performs a DUP, but never both at the same time, unlike the ENTER key in 4-level-stack RPN machines. Also, RPL does not have any "stack lift disable" feature. Hence the necessary differences shown above. <0|ɸ|0> -Joe- |
|||
01-06-2019, 01:10 PM
Post: #12
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
I stand corrected, Joe is right, I misread the OP.
|
|||
01-06-2019, 05:08 PM
(This post was last modified: 01-06-2019 05:13 PM by Bill Duncan.)
Post: #13
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
The following "works for me"[tm].. I have these assigned to variables in the home directory and in the CST file. Add percent, percent of total and delta percent, all preserving in what was the Y register. Simple, effective, I use them all the time on my hp-48gx..
Code:
CST file in the home directory has those functions (as well as others).. YMMV. |
|||
01-06-2019, 08:05 PM
Post: #14
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-06-2019 06:16 AM)RMollov Wrote: DUP is not double ENTER, it is just another name for a single ENTER. Not a big deal to hit it quickly twice Thanks! I think that DUP does act as a double ENTER, as Joe notes. Yes, I wasn't familiar with LASTARG. Amusingly, I'm so used to Ans on algebraic calculators that I didn't realise that it must do something different for RPN/RPL where it's obviously not needed. Using it for LASTARG is great. Agreed that it's more flexible than the RPN route; I tended only to use Y, rather than X, after the % so the fact that X was only in LASTX wasn't a problem. But yes, better to have both. thanks again for the ideas. Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-06-2019, 08:07 PM
Post: #15
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-06-2019 10:48 AM)Joe Horn Wrote: cdmackay: No, that's not correct. During digit entry, one DUP in RPL has the same effect as a double ENTER in RPL, and has a different effect than a single ENTER, as can be seen in these RPL keystroke sequences: yup, got it, thanks! Although I think you meant to quote RMollov not me thanks for clarifying anyway. I find it fascinating how such a simple question opens up some interesting design choices and helps me to understand the way the system works as a whole (well, a bit better, at least). Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
01-06-2019, 08:09 PM
Post: #16
|
|||
|
|||
RE: (RPL) percentage function % not preserving stack level 2
(01-06-2019 05:08 PM)Bill Duncan Wrote: The following "works for me"[tm].. I have these assigned to variables in the home directory and in the CST file. Add percent, percent of total and delta percent, all preserving in what was the Y register. Simple, effective, I use them all the time on my hp-48gx.. thanks Bill; I was going to add those myself, but thought I would force myself to do things the RPL way and use Ans/LASTARG where needed, as it helps me to learn. Just for fun, I also programmed all three on my DM16, which doesn't have any. Silly, as I'm unlikely to pick it up for that Cambridge, UK 41CL/DM41X 12/15C/16C DM15/16 17B/II/II+ 28S 42S/DM42 32SII 48GX 50g 35s WP34S PrimeG2 WP43S/pilot/C47 Casio, Rockwell 18R |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)