A case against the x<>y key
|
05-10-2015, 08:51 PM
(This post was last modified: 05-10-2015 08:56 PM by Mark Hardman.)
Post: #22
|
|||
|
|||
RE: A case against the x<>y key
(05-10-2015 03:51 PM)hansklav Wrote: I certainly wouldn’t advise a starting RPN-user to do it like this on a 4-level calculator without SOS. This is exactly the sort of example you would want in a later chapter in a beginner's guide to RPN. The four level stack is a hard limitation for all but a few non-graphing RPN calculators. The user needs to embrace the possibility of stack overflow instead of fearing it. Part of mastering the 4 level stack, is the ability to quickly "pre-parse" an expression for a plan of attack and for pitfalls and possible overflow. For me, I first parsed this as you did: a - b + c + d. Red flag, there is a non-associative operation, I'm going to need to have a and b on the stack in that order at some time. It might as well be early on so I'm only using one stack level rather than two. That takes care of the first and second terms of the equation. The third term: no problem there--it can be done with three levels of the stack and still only use one stack level when complete. Last term: red flag, the inner-most part of this term will potentially overflow the remaining three levels of the stack; but the -9^2^3 is really -9^8 (or can be done in two levels using x<>y). Good, we're safe from overflow and have a plan of attack--GO! This took all of 5 seconds and saved me possible minutes during the course of evaluation. IMHO, the key to success with the 4 level stack is thinking about how a particular expression should be solved. Rules that the Beginning User "Has to" or "Should" follow can cause more harm than good. Ceci n'est pas une signature. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)