Forum Discussion

nicolacamon's avatar
nicolacamon
Copper Contributor
Mar 10, 2022

Excel wrong calculation

Hi,

i would like to suggest you to check a math colculation with Excel:

 

-5^2+25

 

by math rules should be equal to 0, but Excel is calculating result as 50.

I doubt there is a (maybe known) problem regarding the order operator precedence in the  expression parser.

 

This was a tricky game in the social... but finding that Excel is calculating wrong... i'm here just asking you.

 

Regards,

--- Nicola Camon

4 Replies

  • warrenf320's avatar
    warrenf320
    Copper Contributor
    I have the same issue.
    I typed in the formula "-B7^2 + 123.4" and it was parsed as (-B7)^2 + 123.4 rather than as -(B7^2) + 123.4 Ouch!!!
      • warrenf320's avatar
        warrenf320
        Copper Contributor

        HansVogelaar 

         

        Thanks for pointing out MS's approach to expression evaluation. It is a pity that MS choose to not follow mathematical tradition. I have advanced degrees in math and physics and I would not have expected this behavior. I have even written expression parsers. Do common programming languages do the same, or has Excel marched down its own unique path? For example, I use Matlab from Mathworks and it reports -5^2 + 25 as 0, not as 50. Python reports -5**2 + 25 as 0 too.

Resources