[ANN] Simple RPN Calculator on RevOnline

Andre Garzia andre at andregarzia.com
Wed Oct 13 16:18:08 EDT 2010


Craig,

I debated with myself for some time today regarding the minus sign. The best
solution is having two buttons one for changing the sign and other for the
operation.

Right now, my minus button will behave like this:

(1) if there is a text that is on the "entry field" which is the buffer
place where the calculator displays the numbers before you pressing enter
and push them into the stack, if there is a number there, then the minus
sign with change the number sign.

(2) if there is no number in the entry field, the minus sign will execute
the subtract operation on the two numbers on the stack

so, to execute 4 - 2 you could go:

4 ENTER
2 ENTER
-

or

4 ENTER
2 MINUS
+

which is the same thing since it actually does 4 + (-2)

I may add some buttons and features there and then solve this issue by
having a negation button. What do you think?

As for registers, right now I don't have any, just a simple stack but I plan
to add more features. Some day I may implement multiple stacks to work out
multi level calculations or maybe some registers.

I love my HP 48 GX and my dream calculator is the 16C (the programmers one,
impossible to find).

:-D

On Wed, Oct 13, 2010 at 4:55 PM, <DunbarX at aol.com> wrote:

> Andre.
>
> Andre.
>
> As a reverse Polish afficionado from the days of the HP-35, I have to tell
> you that the following sequence fails:
>
> 1- Key in a 6
> 2- Enter
> 3- Key in a 5
> 4- Key in "-" (minus)
>
> In an RPN calculator, the enter key terminates data entry, and the next
> argument (or operand) is loaded for immediate action. This is operator
> postfix
> notation. I am sure you know this.
>
> Your minus sign correlates to a "change sign" key on an HP calculator. I
> cannot do a subtraction at all. A bug? Or me? But a gorgeous little
> calculator. Did you ever see, and I forget which model it was, an HP with
> all four
> stack registers ("X", "Y", "Z", and "T") visible at once in a four line
> display? Must have been about 1980 or so. You can watch as you build and
> collapse
> the registers as you work a multi-level calculation.
>
> Regards,
>
> Craig Newman
>
>
> In a message dated 10/13/10 1:18:30 PM, andre at andregarzia.com writes:
>
>
> > Folks,
> >
> > I've decided to share my little RPN Calculator on RevOnline.
> >
> > http://revonline2.runrev.com/download/stack/518/RPN-Calc
> >
> > It is quite simple and it has a minimalistic stack (the data structure,
> > not
> > the file format) implementation on the stack script. I am quite fond of
> > this
> > little piece. It was quick to implement, I find it pleasing to the eye
> and
> > I
> > use it as my default calc on linux
> >
> > Andre
> >
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



-- 
http://www.andregarzia.com All We Do Is Code.



More information about the use-livecode mailing list