HP48
|
10-23-2020, 10:29 PM
(This post was last modified: 10-24-2020 08:07 AM by David22.)
Post: #4
|
|||
|
|||
RE: HP48
(10-12-2020 12:29 AM)mobi323 Wrote: Does the HP48 have a "Last X" function? Yes, but something different and "better": they have LASTARG command.
I think it was more clear on HP 48S models because those commands labels contained "LAST" over them (there are 4 commands with LAST over them: LAST STACK, LAST ARG, LAST CMD and LAST MENU, on keys "2" and "3"). LASTARG sates for "LAST ARGuments", and it returns the last arguments used. LAST-X in RPN only takes back last X argument (only one argument), while LASTARG on RPL models takes back all arguments from last used command. For example if you compute 5 SIN, on both cases LAST-X and LASTARG returns 5. But if you compute 2 3 + in RPN LAST-X returns only 3 while in RPL LASTARG returns 2 and 3, i.e. two stack levels, as + command take 2 arguments. If you would want you could create a LASTX program (which only returns X) and even you could assign it to LASTARG key, but I don't see a reason for it. That unnecesary program could be something like: « DEPTH -> d « LASTARG -> x « DEPTH d - DROPN x » » This program simply does this: it executes LASTARG and drops all results from it except level-1 stack (the equivalent from X level in RPL). Although you could use it one time (if you use it 2 consecutive times, the second one you would get the argument DROPN got). It can be modified to fix that: « DEPTH -> d « LASTARG -> x « DEPTH d - DROPN x DUP DROP » » Surely it can be done better in USER RPL or SYSTEM RPL, but this was a fast development (for an unnecesary program). IMPORTANT: As a lot of things on this machine, it can be customized: LASTARG functionality can be disabled by user/soft: -55 flag controls its state: if it is set (for example with -55 SF, or setting it on MODES menu) LASTARG is disabled, and if you try to use LASTARG command (or ARG key) you will get an error: "LASTARG Error: LASTARG disabled". But by default it is activated and most of us have it activated always (at least I do). The reason to have the option to disable it is to be faster in some programs: if you have it enabled system has to record last arguments for possible temporal use, and that may consume more resources than in a simple RPN calculator where you only stores a number on LAST-X memory. Think that if you are operating for example with some very large matrix LASTARG stores temporally a copy, and that takes some CPU time and some extra memory. But I think most of use have LASTARG always on (and only a few intensive programs can have it disabled: mine never had). |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
RE: HP48 - Steve Simpkin - 10-12-2020, 02:20 AM
RE: HP48 - David22 - 10-23-2020 10:29 PM
RE: HP48 - John Keith - 10-24-2020, 12:23 PM
RE: HP48 - John Keith - 10-24-2020, 08:08 PM
|
User(s) browsing this thread: 3 Guest(s)