Re: RPN - why 4 registers? Message #2 Posted by bill platt on 2 Nov 2003, 1:12 p.m., in response to message #1 by adam
With only 3 levels (the earliest machines--pre-handheld) you really do not have enough levels to deal with pending operations without being very careful. 4 levels seems just about right for almost all the time--any more levels hand you cannot relly remember how many pending ops you have going!
Regarding the constant--the Z register does not make a constant---the T does---T duplicates itself any time the stack drops a level (after an arithmatic operation between x and y for instance). So, fo a constant, you "load the stacK" thus C <enter> <enther> <enter> puts the C in all 4 levels. now, any new value typed into X may be operated against the Constant. To operate a new item against the constant, simply type backspace or clx, to clear the last result, and type the new number to be operated on, and then operate on it. (Don't hit "swap" after clearing though, as that will enable the stack and you will have a "0" in y!)
Alternatively, you can use the LST x register to hold a constant--but then you have to do a "swap" (also called x><y) before operating--to preserve the constant ---or you can enter your first object to be operated on by the const, then type the constant, then operate, then type a new number, then lastx, then operate, and so on. In the latter case, your recent results will "scroll down" and fill the stack. You can then see the last results (rolling the stack does not alter the lastx contents).
So, depending on what you are doing, you have a variety of choices. They all make sense for different situations.
And of course you also have lots of registers, too!
Regards,
Bill
|