DUP n "erzats"
|
03-09-2016, 03:20 PM
(This post was last modified: 03-09-2016 03:36 PM by Dieter.)
Post: #7
|
|||
|
|||
RE: DUP n "erzats"
(03-09-2016 12:45 PM)ggauny@live.fr Wrote: Well I see that my think is not well writed and I me scuse. In others words I was thinking of the DUPN function in HP48 to HP 50g, what it is showing in attachement 1. OK,. I do not have any experience with RPL, but if I get the idea of DUPN it copies the lowest n stack levels and pushes up the rest, i.e. it would look like this: Code: DUP 0 DUP 1 DUP 2 DUP 3 So DUP 0 does nothing, DUP 1 copies the first level (=X in RPN calculators) just like simple ENTER, and DUP 2 copies X *and* Y. In all cases the remaining stack levels are pushed upwards. Is this correct? On an RPN calculator the argument for DUPN is kept in X. This would mean the stack changes as follows. This time I used numbers to make the effect more clear. Code: T: 333 → 333 333 → 333 333 → 222 333 → 111 Is this what you want? If yes: fine. If it's not: please post another stack diagram with the results you want to achieve. Since I am not familiar with RPL I cannot say why the DUPN in your sample program is required and what exactly it does there (Edit: but see below). However I am sure on the WP34s there is no need for a DUPN in this specific program. Hmm... if you really want nothing but this... (03-09-2016 12:45 PM)ggauny@live.fr Wrote: ...if x register is valued 0 not copy the real value of x in y, but if value is one we copies in y register....this can be done easily (for x=0 or 1, that is): Code: ... If x≠0 this copies Y to Z and moves Z to T. Finally the parameter n (0 or 1) is dropped. This leaves the stack with the original value in X (n=0) or in X and Y (n=1). Is this what you want? Edit: I know seem to understand how the RPL program works. It determines whether the weekday of the test date is a Friday or not. The NOT command returns either 0 or 1, so the following DUPN is either "nothing" or "DUP". On a 34s this can be done with the three lines above. Even the preceding NOT command can be omitted if the test is inverted to "x=0?": Code: ... Try it and see what you get. I did not do any tests. ;-) Dieter |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
DUP n "erzats" - ggauny@live.fr - 03-08-2016, 12:22 PM
RE: DUP n "erzats" - Dieter - 03-08-2016, 07:53 PM
RE: DUP n "erzats" - Didier Lachieze - 03-08-2016, 08:13 PM
RE: DUP n "erzats" - Dieter - 03-08-2016, 09:28 PM
RE: DUP n "erzats" - jch - 03-08-2016, 09:01 PM
RE: DUP n "erzats" - ggauny@live.fr - 03-09-2016, 12:45 PM
RE: DUP n "erzats" - Dieter - 03-09-2016 03:20 PM
RE: DUP n "erzats" - Dieter - 03-09-2016, 09:19 PM
RE: DUP n "erzats" - ggauny@live.fr - 03-10-2016, 08:19 AM
RE: DUP n "erzats" - Dieter - 03-10-2016, 02:31 PM
RE: DUP n "erzats" - ggauny@live.fr - 03-11-2016, 07:21 AM
|
User(s) browsing this thread: 1 Guest(s)