News for hackers. Stuff that matters.
Re:How does the calculator percent key work? (2008) by Macha on Wednesday April 29, 2015 @03:58AM (#9456954)
<fraction button> 3 + 4 <down> 5 + 6 <right> + <fraction button> 7 + 8 <down> 9 + 2 =

(19 button presses)

Or:

((3 + 4) / (5 + 6)) + ((7 + 8) / (9 + 2))

(27 button presses)

vs on RPN:

+ / + 3 4 + 5 6 / + 7 8 + 9 2 (I think? I don't use RPN)

(15 button presses)

I guess 19 vs 15 button presses is a tradeoff I'm willing to make for easier understanding.

Re:How does the calculator percent key work? (2008) by lambda on Wednesday April 29, 2015 @08:34AM (#9457792)
I'm not familiar with the fraction button. Is this common on calculators? I don't see it on most of the basic function calculators that I look at. Hmm, taking a look around, it looks like it might be present on a lot of scientific calculators, but not the basic calculators I see. I had switched to RPN by the time I started using scientific calculators, so I guess I never became familiar with this button.

Parentheses are common on scientific caclulators and graphing calculators, but as you demonstrate, they add a lot of extra button presses, and you even left out the final "=".

To do this on an RPN calculator, you need nothing beyond the basic 4 functions and the enter key, while you need extra specialized keys like parens or a fraction button to do it on an infix calculator. Taking a look at various infix scientific calculators, they mostly seem to have both parens and a fraction key, so using up the space of 3 keys that an RPN calculator doesn't need and can use for more actual functionality.

Here's how you do it on RPN:

3 <enter> 4 + 5 <enter> 6 + / 7 <enter> 8 + 9 <enter> 2 + / +

You wrote it in Polish notation rather than Reverse Polish Notation, and had left out the enter key that is used as the delimiter between two numbers (pushes a number to the stack, so you can start entering the next number).

Re:How does the calculator percent key work? (2008) by jonsen on Wednesday April 29, 2015 @04:11AM (#9456993)
RPN:

  3 (enter) 4 +
  5 (enter) 6 +  /
  7 (enter) 8 +
  9 (enter) 2 +  /  +
Re:How does the calculator percent key work? (2008) by DougBTX on Wednesday April 29, 2015 @05:01AM (#9457119)
So 19 presses too, that's got a nice "essential complexity" feel to it.
Re:How does the calculator percent key work? (2008) by sukilot on Wednesday April 29, 2015 @04:35AM (#9457053)
You can elide one pair of parens.

You forgot the R part of RPN.

Re:How does the calculator percent key work? (2008) by jonsen on Wednesday April 29, 2015 @04:27AM (#9457033)
Fine, if you can "paint" the full equation on your calculator. But on simpler calculators people may have a hard time getting it right.

  3 + 4 = / ( 5 + 6 = + ( 7 + 8 ) / ( 9 + 2 =