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

abdulshaik

New member
Local time
5:38 PM
Messages
2
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 Computer My Computer

OS
Windows 7 64 bit
Hi Abdul and welcome to W7 Forums :party:

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 ^ unitary sign key.PNG C
 

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Dwarf Dwf/11/2012 r09/2013
OS
Windows 8.1 Pro RTM x64
CPU
Intel Core-i5-3570K 4-core @ 3.4GHz (Ivy Bridge) (OC 4.4GHz)
Motherboard
ASRock Z77 Extreme4-M
Memory
4 x 4GB DDR3-1600 Corsair Vengeance CMZ8GX3M2A1600C9B (16GB)
Graphics Card(s)
MSI GeForce GTX770 Gaming OC 2GB
Sound Card
Realtek High Definition on board solution (ALC 898)
Monitor(s) Displays
ViewSonic VA1912w Widescreen (VGA)
Screen Resolution
1440x900
Hard Drives
OCZ Agility 3 SSD 120GB SATA III x2 (RAID 0)
Samsung HD501LJ 500GB SATA II x2
Hitachi HDS721010CLA332 1TB SATA II
Iomega 1.5TB Ext USB 2.0
WD 2.0TB Ext USB 3.0
PSU
XFX Pro Series 850W Semi-Modular
Case
Gigabyte IF233
Cooling
1 x 120mm Front Inlet 1 x 120mm Rear Exhaust
Keyboard
Microsoft Comfort Curve Keyboard 3000 (USB)
Mouse
Microsoft Comfort Mouse 3000 for Business (USB)
Internet Speed
NetGear DG834Gv3 ADSL Modem/Router (Ethernet) ~4.0 Mb/s (O2)
Antivirus
Avast! 8.0.1497
Browser
IE 11
Other Info
Optical Drive: HL-DT-ST BD-RE BH10LS30 SATA Bluray
Lexmark S305 Printer/Scanner/Copier (USB)
WEI Score: 8.1/8.1/8.5/8.5/8.25
Asus Eee PC 1011PX Netbook (Windows 7 x86 Starter)
Got it, Thanks for your response.
 

My Computer My Computer

OS
Windows 7 64 bit
Back
Top