+ Reply to Thread
Results 1 to 11 of 11

Results discrepancy Excel vs. TI Calculator

  1. #1
    Registered User
    Join Date
    09-21-2018
    Location
    Scottsdale, AZ
    MS-Off Ver
    2013
    Posts
    2

    Results discrepancy Excel vs. TI Calculator

    Hello Everyone - first post and seeking some insights. A friend's kid had a homework assignment: Evaluate -(-5)^2

    With common order of operation, PEMDAS, one would think the answer would be -25. Entered in Excel 2013, =-(-5)^2, the answer returned is 25. T.I. 89 calculator returns -25

    Any insights on the discrepancy are appreciated! thx.

    excel.jpg

    TI89.png

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Results discrepancy Excel vs. TI Calculator

    Well:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    works
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Results discrepancy Excel vs. TI Calculator

    According to this (https://support.office.com/en-us/art...rs=en-US&ad=US ) negation in Excel has higher precedence than exponentiation. So, in the expression -(-5)^2, Excel evaluates what is inside the parentheses first (yielding --5^2), performs the negation (5^2), then the exponentiation (25). Your calculator (like my Casio calculator) places negation after exponentiation, yielding the -25 that you see there. To further muddy the water, VBA uses the same order of operations as your calculator (exponentiation has higher precedence than negation). Pull up the VBE (alt-F11) and in the immediate window enter debug.print -(-5)^2 and it will output -25 like your calculator (help file for operator precedence in VBA: https://docs.microsoft.com/en-us/dot...tor-precedence ).

    Wikipedia has a short entry on this: https://en.wikipedia.org/wiki/Order_...ons#Exceptions

    In summary -- you, the programmer, will need to be aware of how Excel (or whatever programming language you choose to use) handles the ambiguity in cases like -a^b -- and when it conforms to your expected PEMDAS and when it differs.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    09-21-2018
    Location
    Scottsdale, AZ
    MS-Off Ver
    2013
    Posts
    2

    Re: Results discrepancy Excel vs. TI Calculator

    Thank you, That explain's it. Though I wonder why they put negation above exponentiation in the default hierarchy? But thanks again.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Results discrepancy Excel vs. TI Calculator

    Considering that Excel is over 30 years old, I doubt that anyone today recalls why they decided to do this. I would hypothesize that, like the "year 1900 as leap year but it really isn't" bug (https://support.microsoft.com/en-us/...is-a-leap-year ), the earliest spreadsheets (Visicalc or Lotus 1,2,3) chose this convention, and Microsoft Excel had to adopt this convention in order to be compatible with what was then the dominant spreadsheet. In a kind of "founder effect", once the earliest dominant spreadsheet had decided to use this convention, all others followed suit. Once established, compatibility issues prevented changing to a different convention. Of course, this only pushes the question of "why" back to those earliest spreadsheets, and doesn't really answer the question.

  6. #6
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Results discrepancy Excel vs. TI Calculator

    @ MrShorty

    I am still not getting this.

    -(-5^2) = -25

    This looks to me like proper application of PEMDAS and yields the correct answer.

    What am I missing?
    Dave

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Results discrepancy Excel vs. TI Calculator

    Very interesting - if the exponent is on the 5 rather than the close parenthesis it works

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Last edited by xladept; 09-21-2018 at 05:17 PM.

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Results discrepancy Excel vs. TI Calculator

    Yes.

    I guess don't see a problem here.

    It appears to be fundamental algebra and proper formula setup ... ie solve what's inside the () first. Excel is quite consistent in honoring this from what I have observed.

    Perhaps PEMDAS needs to be amended ... ()PEMDAS ...

  9. #9
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Results discrepancy Excel vs. TI Calculator

    FlameRetired -- Correct -(-5^2) correctly evaluates to -25 -- even in Excel. But that was not the exact example the OP used. Note the different placement of the closing parenthesis:

    -(-5^2)=-25 -- yours
    -(-5)^2=+25 -- OP's

    Ultimately this boils down to how to interpret the vague expression -a^2. When expressed like this, do we mean -1*a^2 (like xladept expands the expression, and the way most programming languages and algebra teachers would describe it) where we are assuming the leading - sign is indicating a multiplication by -1. Or do we mean (-a)^2 (which is how Excel [incorrectly??] interprets the problem) where the leading - sign is an integral part of the number.

  10. #10
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Results discrepancy Excel vs. TI Calculator

    Note the different placement of the closing parenthesis:

    -(-5^2)=-25 -- yours
    -(-5)^2=+25 -- OP's
    Noted. It just seemed to me to be more "mathematically correct". It just looked like Excel actually gets it right and TI gets it "buoɹʍ".

  11. #11
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: Results discrepancy Excel vs. TI Calculator

    Quote Originally Posted by FlameRetired View Post
    It just seemed to me to be more "mathematically correct". It just looked like Excel actually gets it right and TI gets it "buoɹʍ".
    (Clever upside-down text. Send me a PM to tell me how you did that.)

    Most people would argue the opposite. But the fact is: there is no "right" or "wrong". Every programming language establishes its own precedent rules. APL evaluates expressions strictly right-to-left; there are no other precedence rules. So 3*4+5 is 27, not 60. "Wrong"? Of course not!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. discrepancy in vlookup function results
    By nazaninibb in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-08-2017, 03:38 AM
  2. Copying lots of data into a calculator and listing results back with original data
    By Davexcelhelp in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2015, 05:29 AM
  3. discrepancy between Excel and Google spreadsheet import
    By Bniemeyer in forum Excel Formulas & Functions
    Replies: 16
    Last Post: 01-26-2014, 05:53 PM
  4. Replies: 14
    Last Post: 11-23-2010, 05:46 PM
  5. Discrepancy between Word and Excel syntax?
    By prawer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-15-2009, 08:54 PM
  6. Integrated calculator in excel 07 instead of separate calculator
    By Wayne in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-26-2006, 11:20 AM
  7. Excel vs. calculator multiplication product discrepancy...
    By Jray in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-05-2005, 06:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1