|Roll-Stack Population Register _aka_ Stack-only Solution in Three Steps|
Message #26 Posted by Glen Kilpatrick on 8 Feb 2003, 11:04 a.m.,
in response to message #1 by Ex-PPC member
I accidentally discovered this last night, present it for mutual amusement. I don't consider it a "real" solution to the presented problem, but instead more of a disclosure of an incompletely presented RPN (by HP, no less! :).
I recently got a 17Bii from Randy Sloyer (THANKS!), and it differs from a 17B primarily in having RPN (so they say, but read on). So carefully follow the bread crumbs below to See What Happens:
[A] Shift MODES RPN ---> see RPN MODE
[B] Shift CLEAR DATA ---> 0.00
[C] ( ( ( ( ---> 0.00 repeated, just like you'd expect; note that in RPN mode, "(" is the Stack Roll Down.
[D] 4 INPUT 3 INPUT 2 INPUT 1 ( ( ( ( ---> yept, Life Is Good, see 1.00, 2.00, 3.00, & 4.00
[E] v & ^ ---> Roll Down & Roll Up work just like we're familiar with; note these are the all-purpose roll keys between the Shift and the INPUT keys.
[F] Shift CLEAR DATA 1 v v v ---> hmmm, all we see are 1.00, this doesn't seem right.
[G] Shift CLEAR DATA 2 INPUT 1 v v v v v ---> alternating 2.00 & 1.00, _no_ zeros.
[H] Shift CLEAR DATA 3 INPUT 2 INPUT 1 v v v v v ---> 2.00, 3.00, 1.00, 2.00, 3.00 ..., and this is beginning to make sense (^ gives you the opposite sense, confirms the stack roll goes up too).
So [F] through [H] show you that the stack is not a constant four levels TZYX, but instead starts out at one level, and is "populated" as appropriate.
[I] Shift CLEAR DATA ) 1 v v v v v ---> 0.00, 0.00, 1.00, 0.00, 0.00, 1.00 ...; ")" or X<>Y seems to be the exception, SWAP populates levels 1 & 2 (RPL terminology seems more appropriate now), and a numeric entry pushes them up to 2 & 3.
Having now presented the rationale (and examples for those not endowed with a 17Bii), I present a three-step, stack-only solution to the original problem  B A ---> B B A:
Shift CLEAR DATA "B" INPUT "A" ---> Setup of initial conditions; we now have a two-stack, B over A.
^ or v or ( ---> we now have a two-stack, A over B
INPUT ---> three-stack, A over B over B
^ ---> voila!, B over B over A (and indeed, we don't care about the "T" register, it's not yet been "invented".
[J] + + + + + + v v v v v ^ ^ ^ ^ ---> 8.00 repeated (remember, we're coming from the Z:3 Y:3 X:2 of above, and I use those "levels" loosely); those two additions appear to "consume" levels 3 & 2, so that we're left only with level 1 (not exactly RPL behavior, the third "+" would error with it).
This experiment appears to suggest an alternate and cleaner view, that we really are adding repeatedly "0.00" to X, and that we really have an empty T-register (and four stack levels, whew, we're back to RPN). However, there's a "Roll-Stack Population Register" somewhere that advises the roll keys how high to roll. On a true RPN this would always be "four", but on a 17Bii it apparently can be anything between one and four.
[K] 4 INPUT 3 INPUT 2 INPUT 1 + + + + + + + + ---> 3.00, 6.00, 10.00, 14.00, 18.00, 22.00 ...; now *this* is our familiar T-register (RPN) behavior.
Conclusion: Until you have all four levels populated (that is, your Roll-Stack Population Register is four), don't trust your 17Bii to Roll in true RPN fashion.
Perhaps somebody with a 19Bii can advise how faithful its RPN behavior is.
P.S. My hat's off to Paul Brogger for his "Re: RPN challenge -- Not quite 3 steps, but a solution to the general problem . . . ", most amazing. As I don't have a true RPN (and 17Bii's don't do procedural programming anyway), I can't test it, only admire it.