You shouldnt be adding the parentheses automatically. If I want 6 + 3 , youre giving me (6 + 3) .
Gary James 9 days ago
Apparently my subscript number 2 got stripped off my message. It should have said ' You shouldn't be adding the parentheses automatically. If I want 6 + 3^2 you're giving me (6 + 3)^ 2)
Kevin Robertson 9 days ago
There is no error. The parentheses are needed for the 'X2' button.
Without them the answer to your equation is 15 which is not 9 squared.
The numbers (6 and 3) need to be summed first to get the correct answer of 81.
Gary James 9 days ago
There is an error because for the given expression, the correct answer IS 15, not 81. That's why it should be up to the user to place his own parentheses.
Gary James 9 days ago
In mathematics the operator order of precedence is:
Parenthetic subexpressions
Exponentiation
Multiplication and Division
Addition and Subtraction
Kevin Robertson 9 days ago
Kevin Robertson 9 days ago
If you want 6+3^2 there is an exponentiation button that will give the equation without the parentheses.
It is only the X2 button that adds the parentheses to sum up those values first before squaring the sum.
Gary James 9 days ago
In this version of Rich's calculator there IS NO EXPONENTIATION BUTTON. By adding the parenthesis automatically the calculator changes my math expression. I want the answer 15, NOT 81.
The code should just add the '^' and then call DoCalc to evaluate the expression.
Gary James 6 days ago
Maybe this will clear it up. What I was saying was, if I enter the expression "6 + 3", and then press the X' key I was expecting the calculator to only square the number 3, as it was the last number (or parenthetical expression) before pressing the X' key. Instead, what the calculator does is square the entire expression. By squaring the entire expression I'm forced to enter the keystrokes "3" ,"X'" , "+", "6", "=" to get my answer of 15. That seems unnatural. That's almost like the Reverse Polish notation used in the old HP Calculators.
Kevin Robertson 6 days ago
This is the exact same functionality that the Windows Calculator has (there is no reason why the functionality of the X2 button should be different). For the calculation you want, as I said, use the exponentiation button (which is on the form). My screenshot below shows both calculations.
Kevin Robertson 6 days ago
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.