RPN_calculator

user_icon kevin_karplus shared it 1 year, 4 months ago
880 views, 14 people love it, 1 tagger, 143 downloads, in 6 galleries, 5 remixes
Add to my favorites?
Flag as inappropriate?

Comments

You need to be logged in to post comments

Add a Comment

kevin_karplus kevin_karplus 7 months ago

As it says in the comments: "The biggest limitation is the use of scoreboards for output, as they are only capable of showing one decimal place of accuracy." Actually, the new scoreboards will change to show more decimal places when the number is between -1 and 1, but it is a sudden jump from one place after the decimal to 6 places. I was considering using my print_scientific program to replace the scoreboard.

(view all replies)
Comment Reply

la_appels la_appels 7 months ago

I have tried to understand how you can print several decimal places for your stack x variable. I cannot see it. I have the new beta version of scratch and I do understand print_decimal.sb, but I do not see anything here that makes the web program print several places. Even the downloaded version of PRN prints only to one place on my computer. Am I missing something obvious? Thanks for any guidance you can provide. --- Lee

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 8 months ago

This has been upgraded to (link to project) using the functions of Scratch v1.2.1

(view all replies)
Comment Reply

Chrispy Chrispy 8 months, 3 weeks ago

Wow.

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 9 months, 1 week ago

I am planning to re-implement the calculator in v1.2. It should be much easier now! I should check to see if the variable display problems in v1.1 have been fixed in v1.2 beta.

(view all replies)
Comment Reply

pasta3049 pasta3049 9 months, 1 week ago

I have implemented hyperbolic functions in a scratch project in 1.2 beta but i have not yet added the inverses. (link to project)

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 10 months, 1 week ago

I could probably implement approximations to hyperbolic functions, but I'd have to do some library research first, as I don't know the best approximation methods for computing them.

(view all replies)
Comment Reply

Oldschooler2 Oldschooler2 10 months, 1 week ago

Hey kevin_karplus do you know how to make a scratch project demonstrating the hyperbolic trigonometric functions and the inverse of them?

(view all replies)
Comment Reply

pasta3049 pasta3049 10 months, 2 weeks ago

I have made a copy of this with a slight improvement. If you try to divide by zero, the divide button flashes. (link to project)

(view all replies)
Comment Reply

lanying lanying 11 months ago

Once you get used to RPN, there's no going back. Another benefit is that there is no need for a clear key or an equal key. The enter key replaces those as well as removing the need for parenthesis ( ). We had to program something similar in Pascal! It was a text-base programming assignment, of course. I miss my HP calculator, too.

(view all replies)
Comment Reply

Corkscrew55 Corkscrew55 1 year ago

too confusinn

(view all replies)
Comment Reply

jasa jasa 1 year, 2 months ago

Nice calculator! I once had also an HP 41CV. Just as a side matter, I once taught my 10 years daughter how to "verbalize" math operations (she was in 5th grade I think... For instance "the sum of 4 and 3" In current math is 4+3 (of course) However is Lisp is (+ 3 4)... Yeah, she learned Lisp in a few minutes :-)

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 2 months ago

I've thought about ways to get better display. I'll probably rewrite my print_decimal script to handle scientific or engineering notation (so that 31569 would be printed as 31.569e+03), then replace the variable-display windows (which I regard as badly broken in scratch) with the print_display.

(view all replies)
Comment Reply

bigB bigB 1 year, 2 months ago

very clever and fantastically wellmade. im impressed by how you allow numbers to change in value when another number is pressed. i mean how when you press 3 it is worth 3 but if you then press for the three is worth 30. just an idea, if you multiply an answer by ten you effectively get an extra decimal place.

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 2 months ago

java implementation truncates results of e^x at ridiculously low value (around e^41.366), while the squeak implementation works well up to a reasonable level, but crashes when you try e^1000

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 2 months ago

The RPN concept is simple---you have to have the numbers to manipulate *before* you do an operation on them. It allows complex operations without needing parentheses or operator precedence. Once you get used to using it, you wonder why anyone would use an infix calculator!

(view all replies)
Comment Reply

Kaydoodle13 Kaydoodle13 1 year, 2 months ago

Not get it

(view all replies)
Comment Reply

Kaydoodle13 Kaydoodle13 1 year, 2 months ago

Into the program.

(view all replies)
Comment Reply

Kaydoodle13 Kaydoodle13 1 year, 2 months ago

I don't understand because I am young and not used to these types of calculators. But I am intelligent enough to get the gifted program.

(view all replies)
Comment Reply

chalkmarrow chalkmarrow 1 year, 2 months ago

Excellent work. Makes me sentimental for my old HP-41CV...

(view all replies)
Comment Reply

jimmit jimmit 1 year, 3 months ago

Wow! Your method of doing the trig functions is awesome. What a great idea!

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 3 months ago

Bug worked around by using large number instead of small number.

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 3 months ago

A serious bug is introduced by scratch when it saves the program. I entered 0.0000001 as the error limit, but it got converted to 1.e-07 by scratch (ok so far). When scratch saved the program, it changed the 1.0e-7 to 1, which is *NOT* ok.

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 3 months ago

It is a calculator. It calculates. I've upgraded to include some trig functions. Arctan works *better* in java implementation than squeak.

(view all replies)
Comment Reply

chella_bella123 chella_bella123 1 year, 3 months ago

what is it surposed to do

(view all replies)
Comment Reply

kevin_karplus kevin_karplus 1 year, 3 months ago

Jamie, this is a reverse-polish notation calculator, like an HP scientific calculator. You put in a number, hit enter, put in another number, hit the operator. RPN calculators are easier to implement and easier to use than parenthesis calculators, but they take a little getting used to for people who have been corrupted by TI calculators.

(view all replies)
Comment Reply

jamie jamie 1 year, 3 months ago

what?????????????

(view all replies)
Comment Reply