|08 Sep 2011||#1|
| || |
Windows 7 Calculator - Question on the logic for executing functions
When we perform following operation on Win 7
(9.1*10^ - 31*3*10^8) =
we can see the equation getting formed in following way:
what we see on the screen is this
and result on = comes to following
I would like to know on pressing - sign after ^ windows seems to replace the ^ operation with - operation. And when it does that it fails to compute the 9.1*10. To explain, if you execute same math equation with ^ sign i.e. as below:
(9.1*10 - 31*3*10^8) =
window shows result as 91 the moment you input - operation in sequence.
I predict the same behavior even for the equation where user inputs - sign immediately followed by ^ sign. If window is replacing the - operation with ^ then logically it should do the same what I have explained above in Scenario 2.
Not sure what different logic windows is applying here. When I try to execute same logic on JEP Parser (Jep Console - DJep/JEP Java Math Expression Parser) this is what JEP gives as result:
JEP > (9.1*10 - 31*3*10^8)
It seems there is a bug in the way Windows 7 replaces operation but forgets to execute its preceding operation, even though the precedence of previous operation is HIGH as compared immediate next operation.
Let me know if any one observed similar issue and what could be the correct way of implementation here.
Thanks in advance.
|My System Specs|
|08 Sep 2011||#2|
| || |
Hi Abdul and welcome to Windows 7 Forums
I've had a look at this and what I think is happening is this:
Normally, operators function in line with the normal hierachial preference (unitary sign, power, multiply and divide, plus and minus) unless the sequence is overridden by the use of parentheses (). A sum is evaluated as it is inputted so long as the hierachial level of each operator is the same or lower than the preceding one. However, when an operator of higher precedence is inputted, things change. In that case, the previous operator is not executed until after the current operation. Let's use an example:
A * B ^ C
With this, A is multiplied by the result of B risen to the power of C. It is not the result of A multiplied by B and then risen to the power of C. To achieve this, the first term needs to be enclosed in parantheses like this:
( A * B ) ^ C
Now, let's assume you made a mistake and that you really wanted to input a minus sign instead of the power. So you enter the following:
A * B ^ - C
The first term is still waiting for the outcome of the second term before it is executed, even if the operator of that term is corrected from one of higher precedence to an equal or lower one.
This is what I think is happening with your equation. You are wanting to raise B to a negative power of C, but instead are inadvertently changing the operator as described above. The correct operation can be done in two ways.
First of all, enclose - C in parentheses, so you get A * B ^ ( - C )
Secondly, use the unitary sign key, resulting in A * B ^ C
|My System Specs|
|Similar help and support threads for2: Windows 7 Calculator - Question on the logic for executing functions|
|How do I resintall the Windows 7 Calculator?||General Discussion|
|How to run APPLE LOGIC PRO on win 7 x32||Software|
|Is there any logic to this order?||Chillout Room|
|Logic Gate Simulator?||Software|
|Logic with duplication of contacts||Browsers & Mail|
|Our Sites ||Site Links ||About Us ||Find Us |
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd
All times are GMT -5. The time now is 02:36 PM.