Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'HP 48GX emulator' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
HP 48GX emulator
Authored by: twalkabout on Feb 24, '02 09:48:04PM

Although not entirely related to a command line calculator -- I think the best calculator is the Hewlett-Packard 48GX -- which I used to use all the time for my undergrad degree. Although the RPN takes a bit of time to get used to (about a week or so) -- after you do get used it -- then you'll realize how much easier it is. RPN basically works as follows: Instead of entering "1 + 1 =" you would enter "1 ENTER 1 ENTER +" Which seems completely stupid, until you start to use it for a while, and then it suddenly makes so much sense you won't be able to go back to a normal calculator. Especially for complicated calculations.

There is an amazing emulator for OS X at http://www.markus-fritze.de/x48/


--tom--



[ Reply to This | # ]
HP 48GX emulator
Authored by: babbage on Feb 25, '02 08:27:17PM
It's called 'postfix' math, and the HP calculator is a common teaching tool in introductory programming classes, because [a] it's a great way to reduce ambiguity in your notation, and [b] it's a great way to teach about stack based data structures. Consider:
  • "normal" infix math:
    3 * 4 / 5 = ???
    parentheses are needed to solve the problem, because there is more than one valid way to parse the equation.
  • postfix math:
    3 4 * 5 / = 12 5 / = 60
    or
    3 4 5 / * = 3 4/5 * = 2.4 [or 2 2/5]
    no ambiguity, and solving the problem is a simple series of repitions

The thing to notice is that you keep adding values to your 'stack' until you hit an operator, at which point you pop the top two items off the stack and apply the operator to those two items, placing the resulting value back on the stack, and you repeat this process until the stack is reduced to a single value. figuring out the strategy used by HP's calculators is a great way to learn about stack structures, and knowing how to work with stacks makes all kinds of programming problems easier (stacks describe the most recent web pages visited, the order you're allowed to use tags in valid HTML/XML documents, etc).

I hated that class but I'm glad I understand the material... ;)

[ Reply to This | # ]