Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
P Keenan
 
Posts: n/a
Default MAJOR BUG: Excel operator precedence is wrong

If I enter in a cell "=-1^2" I should see "-1" as the value, not "1". If I
enter "=-A1^2" and the cell A1 contains the value "1", I should see "-1", not
"1". The binary operator "^" should have higher precedence than unary "-",
but does not. (It does have higher precedence than binary "-", as in "=2-2^2"
correctly gives the value "-2", not "0".)

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...et.f unctions
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Toppers
 
Posts: n/a
Default MAJOR BUG: Excel operator precedence is wrong

My understanding is that =-1^2 means 9-1 to the power 2) i.e. (-1*-1)=1

=2-2^2 = 2 - (2*2) = 2 -4 = -2

So Excel is correct according to accepted mathematical operator precedence


"P Keenan" wrote:

If I enter in a cell "=-1^2" I should see "-1" as the value, not "1". If I
enter "=-A1^2" and the cell A1 contains the value "1", I should see "-1", not
"1". The binary operator "^" should have higher precedence than unary "-",
but does not. (It does have higher precedence than binary "-", as in "=2-2^2"
correctly gives the value "-2", not "0".)

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...et.f unctions

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bearacade
 
Posts: n/a
Default MAJOR BUG: Excel operator precedence is wrong


Sorry bud, you need to relearn your algebra..

-1^2 is 1

-(1^2) is -1


--
Bearacade


------------------------------------------------------------------------
Bearacade's Profile: http://www.excelforum.com/member.php...o&userid=35016
View this thread: http://www.excelforum.com/showthread...hreadid=554643

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jerry W. Lewis
 
Posts: n/a
Default MAJOR BUG: Excel operator precedence is wrong

Old news. See Help for "The order in which Microsoft Excel performs
operations in formulas."

-1^2 is ambiguous. The most common convention for order of operations would
interpret it as -(1^2), but as documented, Excel will interpret it as (-1)^2,
and will calculate it correctly given that interpretation. There is no
unversal order of operations that applies to all computer software, so the
user must take responsibility for knowing what their particular package will
do if they intend to write ambiguous expressions.

Jerry

"P Keenan" wrote:

If I enter in a cell "=-1^2" I should see "-1" as the value, not "1". If I
enter "=-A1^2" and the cell A1 contains the value "1", I should see "-1", not
"1". The binary operator "^" should have higher precedence than unary "-",
but does not. (It does have higher precedence than binary "-", as in "=2-2^2"
correctly gives the value "-2", not "0".)

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...et.f unctions



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Tushar Mehta
 
Posts: n/a
Default MAJOR BUG: Excel operator precedence is wrong

Yes, by most accepted standards, -1^2 should be -1. Unfortunately,
there is no "universally" accepted standard on the priority of unary
negation and exponentiation. MS chose to have XL treat the unary
negation as having a higher priority than exponentiation. And, as of
now, it is hard to imagine MS would revisit the topic.

Of course, this lack of a definite rule leads to inconsistency even
within the XL environment itself since in VBA, -1^2 is -1!

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2005

In article , =?Utf-
8?B?UCBLZWVuYW4=?= <P says...
If I enter in a cell "=-1^2" I should see "-1" as the value, not "1". If I
enter "=-A1^2" and the cell A1 contains the value "1", I should see "-1", not
"1". The binary operator "^" should have higher precedence than unary "-",
but does not. (It does have higher precedence than binary "-", as in "=2-2^2"
correctly gives the value "-2", not "0".)

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/comm...et.f unctions

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel opens Hyperlinks with wrong application mcdirt Excel Discussion (Misc queries) 0 June 8th 06 05:08 AM
excel graphs line correctly, shows wrong value label? Need Help 123 Excel Discussion (Misc queries) 0 January 18th 06 07:12 PM
Excel 2003 has wrong timing using the worksheet_change macro Jan Excel Worksheet Functions 0 January 14th 06 06:30 AM
total and subtotal positions wrong in excel Mary Buck Excel Discussion (Misc queries) 1 September 15th 05 07:18 PM
Excel Range Value issue (Excel 97 Vs Excel 2003) Keeno Excel Discussion (Misc queries) 2 June 13th 05 02:01 PM


All times are GMT +1. The time now is 04:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"