Post Reply 
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.

Hans

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.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
A case against the x<>y key - hansklav - 05-09-2015, 10:49 PM
RE: A case against the x<>y key - Les Bell - 05-10-2015, 12:56 AM
RE: A case against the x<>y key - hansklav - 05-10-2015, 10:25 AM
RE: A case against the x<>y key - hansklav - 05-10-2015, 10:37 AM
RE: A case against the x<>y key - hansklav - 05-10-2015, 10:43 AM
RE: A case against the x<>y key - hansklav - 05-10-2015, 02:32 PM
RE: A case against the x<>y key - hansklav - 05-10-2015, 03:51 PM
RE: A case against the x<>y key - Mark Hardman - 05-10-2015 08:51 PM
RE: A case against the x<>y key - hansklav - 05-11-2015, 12:09 AM
RE: A case against the x<>y key - Les Bell - 05-11-2015, 12:24 AM
RE: A case against the x<>y key - Les Bell - 05-11-2015, 12:20 AM
RE: A case against the x<>y key - Tugdual - 05-10-2015, 04:06 AM
RE: A case against the x<>y key - d b - 05-10-2015, 05:16 AM
RE: A case against the x<>y key - hansklav - 05-10-2015, 10:59 AM
RE: A case against the x<>y key - hansklav - 05-10-2015, 09:37 PM
RE: A case against the x<>y key - Les Bell - 05-11-2015, 03:39 AM
RE: A case against the x<>y key - hansklav - 05-11-2015, 09:41 PM
RE: A case against the x<>y key - Les Bell - 05-11-2015, 04:18 AM
RE: A case against the x<>y key - Les Bell - 05-11-2015, 06:10 AM
RE: A case against the x<>y key - RMollov - 05-11-2015, 09:49 AM
RE: A case against the x<>y key - Les Bell - 05-11-2015, 10:27 PM
RE: A case against the x<>y key - hansklav - 05-17-2015, 10:49 PM
RE: A case against the x<>y key - d b - 05-12-2015, 12:35 AM
RE: A case against the x<>y key - Les Bell - 05-12-2015, 01:41 AM



User(s) browsing this thread: 8 Guest(s)