News for hackers. Stuff that matters.
Re:Why is there not a Square Root button in calc.exe? by user24 on Saturday August 21, 2010 @05:05PM (#1623663)
Another interesting calc.exe quirk:

On "Standard" view, type:

1 + 2 * 3 =

Answer comes back as 9

Switch to "Scientific" view and type the same,

Answer comes back as 7

The reason (of course) is operator precedence; in standard mode it's interpreted as "1 + 2 =" then "* 3 =", while in scientific view it respects BODMAS.

But to me it's counter-intuitive that changing the View also changes the Mode of operation.

If they'd just named that menu "Mode" instead of "View" I'd be fine with it.

Re:Why is there not a Square Root button in calc.exe? by andrerobot on Saturday August 21, 2010 @05:32PM (#1623708)
I've used cheap scientific calculators that perform operations from left to right. It's awful when you are answering a uni exam and you don't know why the results you get looks fishy.

On computer calculators, I always type "1 + 2 * 3 =" as "2 * 3 =", "+ 1 =" because I learned the hard way that I can't asume that a calculator is going to respect order of precedence or not.

Re:Why is there not a Square Root button in calc.exe? by sprout on Saturday August 21, 2010 @05:42PM (#1623720)
I think the first calculator I used was one of those. It took me till college and programming before I really properly learned precedence because I never trusted any calculator I was using, and always used parentheses.

This also kind of influences my programming, probably for the better - I would rather use parens and be clear than be ambiguous and trust that my interpreter and I agree on what has proper precedence.

Re:Why is there not a Square Root button in calc.exe? by jacquesm on Saturday August 21, 2010 @06:48PM (#1623806)
The 9 is just plain wrong. Operator precedence is not a scientific thing, that's a grade school thing.
Re:Why is there not a Square Root button in calc.exe? by dchest on Saturday August 21, 2010 @06:53PM (#1623814)
(1 + 2) * 3
Re:Why is there not a Square Root button in calc.exe? by jacquesm on Saturday August 21, 2010 @06:54PM (#1623815)
You've just changed the precedence.
Re:Why is there not a Square Root button in calc.exe? by dchest on Saturday August 21, 2010 @07:01PM (#1623825)
Thanks, I know. I meant that most non-scientific calculators I used worked this way.
Re:Why is there not a Square Root button in calc.exe? by jacquesm on Saturday August 21, 2010 @07:06PM (#1623830)
That doesn't make them less broken!

And if the software has the capability to do it right why bother building in a 'broken' mode.

Re:Why is there not a Square Root button in calc.exe? by evilduck on Saturday August 21, 2010 @08:16PM (#1623927)
It reflects the old paper tape usage model, where you typed it in in the order you wanted to perform the operations.

Apple's Calculator.app works similarly, although their default state is better. If you open up the "Shown Paper Tape" window, and type "1 + 2 * 3 [enter]", it replies "1 + 2 * 3 = 7" If you then type "1 + 2 [enter]", it replies "1 + 2 = 3", then if you hit " * 3 [enter]" it replies "1 + 2 * 3 = 9".

Re:Why is there not a Square Root button in calc.exe? by jacquesm on Saturday August 21, 2010 @08:39PM (#1623958)
Yes, I can see how the 'enter' would force the precedence.

The '=' key will do the same.

Re:Why is there not a Square Root button in calc.exe? by user24 on Saturday August 21, 2010 @07:20PM (#1623850)
I think it's because non-mathematical people tend to use calculators in the 'broken' way. Their thought process is "ok, 1+2" (implicit equals) "times 3".
Re:Why is there not a Square Root button in calc.exe? by dchest on Saturday August 21, 2010 @06:41PM (#1623796)
Mac OS X Calculator gives 7 in any mode. Wow, thanks for the information.
Re:Why is there not a Square Root button in calc.exe? by bugsy on Saturday August 21, 2010 @06:44PM (#1623800)
This really gets to usability. Most scientific calculators I have owned have a y^x key AND a √ key. Most have a cube root key as well. √ is a very common operation and with its own key can on many models be applied to a result with a single key press (it often works immediately and the = is not even necessary.) y^x to indicate square root can be applied to a result with ^,0,.,5,= -> 5 key presses, or 4 if continuing without having to finalize the calculation. Given that √ is a common operation, 4 or 5 key presses for it is pretty ineffective compared to 1 key press.
Re:Why is there not a Square Root button in calc.exe? by ghjghj on Saturday August 21, 2010 @04:50PM (#1623639)
For the benefit of those that don't know: raise to the power of 0.5 instead (x^y button, 0.5, enter).

edit: Doh! That's what the linked page says. In my defense I have a horrible connection tonight and it didn't load until just now :)

edit 2: Lol@ the itchy trigger-finger. Isn't that what the downvote karma limit is for? :)

Re:Why is there not a Square Root button in calc.exe? by japaget on Saturday August 21, 2010 @05:33PM (#1623712)
I'm running calc.exe on Windows XP, and while it is true that there is no square root button, square roots may be calculated using Inv x^2. The Inv checkbox also enables cube roots (Inv x^3), exponentials (Inv ln and Inv log), and the usual inverse trig functions.
Re:Why is there not a Square Root button in calc.exe? by timrobinson on Sunday August 22, 2010 @07:45AM (#1624516)
You find this out by right-clicking the x^2 button and clicking What's This. The popup explains the Inv^2 trick -- to my recollection it's been like that since Windows 95.
Re:Why is there not a Square Root button in calc.exe? by tedreed on Saturday August 21, 2010 @03:27PM (#1623470)
I was going to say that this applies only to old versions of calc, but the calc.exe in W7 has a cube root button, and also a generic y root of x button... but no sqrt. O_o
Re:Why is there not a Square Root button in calc.exe? by redraga on Saturday August 21, 2010 @04:07PM (#1623551)
There is a sqrt button in calc in Windows 7. It's on the right side, just above the % button.
Re:Why is there not a Square Root button in calc.exe? by argsv on Saturday August 21, 2010 @05:59PM (#1623738)
It's a while since I used PowerCalc but I think it's a good replacement for calc.exe for WinXP http://www.microsoft.com/windowsxp/downloads/powertoys/xppow...

some other nice tools there too.

Re:Why is there not a Square Root button in calc.exe? by juanefren on Saturday August 21, 2010 @05:49PM (#1623725)
If a person doesn't know that sqrt is 1^(1/2) probably (just probably...) that person would never need to use sqrt...
Re:Why is there not a Square Root button in calc.exe? by s-phi-nl on Saturday August 21, 2010 @06:27PM (#1623774)
I disagree. One can use square roots to find the roots of quadratic equations (for example the equation for the velocity of a projectile) without needing to know that sqrt(x)=x^1/2.
Re:Why is there not a Square Root button in calc.exe? by john3 on Sunday August 22, 2010 @02:38AM (#1624326)
I think you misunderstood

The point he or she was making was that a person that doesn't know that sqrt(x)=x^1/2 probably wouldn't be calculating the for example velocity of a projectile

Re:Why is there not a Square Root button in calc.exe? by juanefren on Thursday August 26, 2010 @04:28PM (#1637073)
Exactly...