Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Windows 7 Calculator - Question on the logic for executing functions

08 Sep 2011   #1

Windows 7 64 bit
Windows 7 Calculator - Question on the logic for executing functions


When we perform following operation on Win 7
Scenario 1
(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
(9.1*(10- 31*3*10^8))
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:
Scenario 2
(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 SpecsSystem Spec
08 Sep 2011   #2

Windows 8.1 Pro RTM x64

Hi Abdul and welcome to W7 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 ^ Windows 7 Calculator - Question on the logic for executing functions-unitary-sign-key.png C

My System SpecsSystem Spec
08 Sep 2011   #3

Windows 7 64 bit

Got it, Thanks for your response.
My System SpecsSystem Spec


 Windows 7 Calculator - Question on the logic for executing functions

Thread Tools

Similar help and support threads
Thread Forum
BSOD when executing any programs - after Windows Update HP 8470p
Hi everyone Not sure if it's a coincidence or not but for the past 3 days i have been getting persistent BSOD's after Windows Updates ran. I did do a system restore to before the updates were installed but i am still getting BSOD I have reseated the memory and HDD. Run diagnostic tests for...
BSOD Help and Support
How do I resintall the Windows 7 Calculator?
I don't know how or don't know when but I guess I deleted the default Window's 7 Calculator. Can someone please help me reinstall it. Thanks !
General Discussion
Is there any logic to this order?
I've watched this a while and wonder if there is any order to how people appear in this list? Obviously you are always first, but I notice over the course of several hours that peoples position in the order shift around. So, what is the ordering based on? Golden
Chillout Room
calculator question
Is it possible to use the Windows 98 calculator on Windows 7?
Logic with duplication of contacts
Ok, as best I can remember in windows, you maintained your windows contacts in part to be used in windows mail, correct? In XP, you maintained the address book for each user, in part at least, for outlook express. Ok, so why is there a created duplication now that once you import contacts to...
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 10:02.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App