Post Reply 
Stack Overflow Sensing
10-05-2014, 11:39 PM (This post was last modified: 10-09-2014 10:23 PM by hansklav.)
Post: #1
Stack Overflow Sensing
In 1978 in his excellent book 'Algorithms for RPN Calculators' John A. Ball in a separate chapter gave several 'Suggestions for Future Developments' in RPN calculators. Most of these eventually found their way into later calculator models, the most recent being the eight-register stack in the WP 31S and 34S.

He also gave a somewhat elaborate scheme to sense Stack Overflow, which never materialized, maybe because it was a bit too convoluted. His proposal needed a special symbol for 'clear' (which was an incarnation of zero), a CLR key which 'cleared' all stack registers, and an extended R↑ key which also could be used as a number separator instead of ENTER↑. On pressing R↑ a 'clear' appeared in X (the display), provided the stack was not full. By watching for a 'clear' after each R↑ keypress one could ensure that no numbers were lost off the top of the stack. Of course R↑ should temporarily disable stack lift, just like ENTER↑.

I suppose few people would question the usefulness of Stack Overflow Sensing in RPN calculators with a limited stack height. An extended stack height like the eight-register stack makes its need less pressing, but even in the WP 34S in complex number mode the stack height is only four.

A simple Stack Overflow Sensing scheme would be welcome in these calculators. Imho the only essential ingredients would be:
- an 'empty' symbol
- a CLS key which clears the stack registers above X by making them 'empty'. The X register could still be cleared to zero. This key also sets a 'no overflow' flag, which makes an annuntiator NO ('No Overflow') visible
- an extra stack overflow sensing register above the Top of the stack which would clear the 'no overflow' flag and so would make the NO ('No Overflow') annuntiator invisible when a non-empty number would be copied into it from the Top of the stack.

Such a Stack Overflow Sensing scheme can be ignored when you don't need it.
Only when you would like to watch for stack overflow in a very complex calculation you start the calculation by pressing CLS and you watch that the NO ('No Overflow') annuntiator remains visible. In this way you can be certain that the stack did not overflow during your calculation and you can be more confident of your result. Top stack level repetition ('top copy on pop') and Roll up and down would still function.

Interestingly the original HP-35 had most of the hardware needed for the above SOS scheme already on board: a CLR key and the red dot (which could have functioned as a No Overflow indicator).

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
Stack Overflow Sensing - hansklav - 10-05-2014 11:39 PM
RE: Stack Overflow Sensing - Garth Wilson - 10-06-2014, 12:27 AM
RE: Stack Overflow Sensing - hansklav - 10-07-2014, 07:56 PM
RE: Stack Overflow Sensing - walter b - 10-07-2014, 08:15 PM
RE: Stack Overflow Sensing - hansklav - 10-07-2014, 09:10 PM
RE: Stack Overflow Sensing - Paul Dale - 10-07-2014, 10:18 PM
RE: Stack Overflow Sensing - hansklav - 10-09-2014, 09:12 PM
RE: Stack Overflow Sensing - Garth Wilson - 10-07-2014, 10:10 PM

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