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

Hi,

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
-84629999909

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)
-9.299999909E9


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.

Abdul

My System SpecsSystem Spec
.

08 Sep 2011   #2

Windows 8.1 Pro RTM x64
 
 

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 ^ Name:  unitary sign key.PNG
Views: 109
Size:  577 Bytes C


My System SpecsSystem Spec
08 Sep 2011   #3

Windows 7 64 bit
 
 

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


Reply

 Windows 7 Calculator - Question on the logic for executing functions




Thread Tools



Similar help and support threads for2: Windows 7 Calculator - Question on the logic for executing functions
Thread Forum
Solved How do I resintall the Windows 7 Calculator? General Discussion
How to run APPLE LOGIC PRO on win 7 x32 Software
Solved Is there any logic to this order? Chillout Room
Logic Gate Simulator? Software
calculator question 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 01:29 AM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33