Home |
Search |
Today's Posts |
#41
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
fred wrote:
This is in my help too: Reference operators - Negation (as in -1) % Percent ^ Exponentiation * and / Multiplication and division + and - Addition and subtraction & Connects two strings of text (concatenation) = < <= = < Comparison But to me it's immaterial. Why don't they follow the normal mathematical order? If I'm going to sort a list of numbers should I be expected to look up the sort order to see if they deviated from the norm? No. Order of operator precedence is a design decision. Design decisions are made by the developer. If I were writing Excel, I would have interpreted -5^2 to be -(5)^2 rather than (-5)^2, since you wouldn't have bothered with the negation if you hadn't wanted it. But the point remains that neither you nor I wrote Excel; so our choice is to conform to the developer's design decisions or use a different tool. As has been repeatedly noted, -5^2 is an ambiguous expression. The interpretation of ambiguous expressions is based on convention, not immutable rules of the universe. I will even grant that our preferred convention is probably the most commonly used convention; but it is not the only convention, and it does no good to pretend otherwise. Even if MS regretted this particular design decision, I doubt that they would change it. Changing it now could break any number of existing applications, which would cause far more problems and aggravation than than you are currently experiencing. Once you have finished blowing off steam, you will have learned something and will not make that mistake again. Imagine if instead you had to test every single spreadsheet in your company to see if they still worked, because MS suddenly changed the rules! Jerry |
#42
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
In article ,
"Stephen J. Herschkorn" wrote: Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? If you asked someone competent, not just semi-decent, from my high school, or college, or graduate school, you'd get the same curve as y = x^2 but it's a convention, not a law, so it wouldn't be surprising to see the negation of y = x^2 The flaw is in assuming that you have a lock on absolute truth, rather than recognizing that when there's ambiguity you need context. There's no ambiguity that negation and subtraction are different. The fact that the typography is ambiguous means that you need to check your assumptions. Those who insist that a computer application must conform to *their* standard have never programmed in APL. |
#43
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
In my mind:
Documented = feature. Undocumented = Bug. I would still say your problem is with the consultant for not knowing this--or taking far too long to find it. I would bet that "by design" would come up in any conversation with MS. fred wrote: BOULDERDASH!!! This is a horrible bug in Excel (whereof I was previously unaware). It is very standard that exponentiaion takes precedence over negation. Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? Thank you sir! As another poster noted, M.P.E.P is a programming forum, but told that it violates math convention, they still argue. They probably just didn't believe me. Another said "much ado about nothing", but I think this is a horrible bug too. Excel should at least follow regular math conventions. What other surprizes await?! -- Dave Peterson |
#44
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
Dave Peterson wrote:
In my mind: Documented = feature. Undocumented = Bug. I would still say your problem is with the consultant for not knowing this--or taking far too long to find it. I would bet that "by design" would come up in any conversation with MS. Since when I am supposed to hire a consultant to use a basic spreadsheet tool? JE McGimpsey wrote: In article , "Stephen J. Herschkorn" wrote: Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? If you asked someone competent, not just semi-decent, from my high school, or college, or graduate school, you'd get the same curve as y = x^2 Then your high school students are very poorly educated. Do they also consistently misspell the word "friend"? [...] The flaw is in assuming that you have a lock on absolute truth, rather than recognizing that when there's ambiguity you need context. This is as universal a convention as spelliing rules. I dare you to find one publication where -5^2 is calculated correctly to be 25., Those who insist that a computer application must conform to *their* standard have never programmed in APL. This is not just *my* convention. Software such as spreadsheets, word processors, address books, etc. are tools provided for the end user, who most likely is not a programmer. We are not talking JCL here. Your position exhibits the hubris of a software engineer, whose job is to provide the consumer with a reasonable product without asking him/her to remember the contradiction of universally accepted conventions. Hmm, why not make a door which cannot be opened unless the user stands on his head? -- Stephen J. Herschkorn |
#45
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
In article "fred" writes:
Do any of you SCI.MATH whizes want to weigh in on this? Well, contrary to some responders I do not read this in an excel newsgroup (I have no reason to read such a newsgroup...). MS Excel calculates "=-5^2" as 25, not as -25. Yes, that is one of the possibilities. This is because 'negation' is handled first in Excel. (!?) Right, there are quite a few programming languages that do the same. If you put a zero in the equation, as in "=0-5^2", your answer changes to -25. Indeed. Is this in line with standard math rules? Yup, both are in line with standard math rules. There are no standard rules about how unary operators are handled. Is negation different than subtraction? Yes, indeed. I've had lots of math and as far as I know negation and subtraction are the same thing. When you look at the definition for rings, and stuff like that, you will find that they are very different. If you look you will find that a - b is just shorthand for a + b'. where b' is the negative of b. So 0 - 5^2 is shorthand for 0 + (5^2)' There are more places where some programming languages do not give you what you thought they should do. Exponentiaton is an example. What is: a ^ b ^ c? There is not strict left to right rule in mathematics... You may wonder, why should I do a - b + c from left to right? Well, actually you have to transform it to something that is basic mathematics: a + (-b) + c and now it does not matter what way you do the operations. where (5^2)' is the negative of 5^2. -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131 home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/ |
#46
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
The OP hired an excel consultant.
I guess it boils down to a philosophical question. Do you want to use excel the way it was designed or not? I guess I don't understand why it took the consultant so long to find the ^h^h^h his error. "Stephen J. Herschkorn" wrote: Dave Peterson wrote: In my mind: Documented = feature. Undocumented = Bug. I would still say your problem is with the consultant for not knowing this--or taking far too long to find it. I would bet that "by design" would come up in any conversation with MS. Since when I am supposed to hire a consultant to use a basic spreadsheet tool? JE McGimpsey wrote: In article , "Stephen J. Herschkorn" wrote: Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? If you asked someone competent, not just semi-decent, from my high school, or college, or graduate school, you'd get the same curve as y = x^2 Then your high school students are very poorly educated. Do they also consistently misspell the word "friend"? [...] The flaw is in assuming that you have a lock on absolute truth, rather than recognizing that when there's ambiguity you need context. This is as universal a convention as spelliing rules. I dare you to find one publication where -5^2 is calculated correctly to be 25., Those who insist that a computer application must conform to *their* standard have never programmed in APL. This is not just *my* convention. Software such as spreadsheets, word processors, address books, etc. are tools provided for the end user, who most likely is not a programmer. We are not talking JCL here. Your position exhibits the hubris of a software engineer, whose job is to provide the consumer with a reasonable product without asking him/her to remember the contradiction of universally accepted conventions. Hmm, why not make a door which cannot be opened unless the user stands on his head? -- Stephen J. Herschkorn -- Dave Peterson |
#47
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
Dik T. Winter wrote:
In article "fred" writes: Do any of you SCI.MATH whizes want to weigh in on this? Well, contrary to some responders I do not read this in an excel newsgroup (I have no reason to read such a newsgroup...). MS Excel calculates "=-5^2" as 25, not as -25. Yes, that is one of the possibilities. Can you cite one publication, not a computer langauge manual, where the author computed -5^2 as 25? We are talking about the convention of the end user here. If you were helping a child with the school problem to plot y = -x^2, what you show him/her? The fact that there are some expressions (e.g., a^b^c) where precedence is not as standard does not negate that the standard of -x^2 is virtually universal. -- Stephen J. Herschkorn |
#48
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
On Mon, 02 Aug 2004 19:54:48 -0600, JE McGimpsey wrote:
In article , "Stephen J. Herschkorn" wrote: Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? If you asked someone competent, not just semi-decent, from my high school, or college, or graduate school, you'd get the same curve as y = x^2 but it's a convention, not a law, so it wouldn't be surprising to see the negation of y = x^2 The flaw is in assuming that you have a lock on absolute truth, rather than recognizing that when there's ambiguity you need context. There's no ambiguity that negation and subtraction are different. The fact that the typography is ambiguous means that you need to check your assumptions. Absolute nonsense. Are you sufficiently competent to apply the quadratic formula to find the roots of -x^2 + 8x - 15 = 0 and then verify your results by substitution? Those who insist that a computer application must conform to *their* standard have never programmed in APL. APL is a language unto itself. -- Dave Seaman Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling. <http://www.commoncouragepress.com/index.cfm?action=book&bookid=228 |
#49
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
So if a physicist writes an equation he has to include the 'rules of
calculation' for others to use it? Give me a break. "Dik T. Winter" wrote in message ... In article "fred" writes: Do any of you SCI.MATH whizes want to weigh in on this? Well, contrary to some responders I do not read this in an excel newsgroup (I have no reason to read such a newsgroup...). MS Excel calculates "=-5^2" as 25, not as -25. Yes, that is one of the possibilities. This is because 'negation' is handled first in Excel. (!?) Right, there are quite a few programming languages that do the same. If you put a zero in the equation, as in "=0-5^2", your answer changes to -25. Indeed. Is this in line with standard math rules? Yup, both are in line with standard math rules. There are no standard rules about how unary operators are handled. Is negation different than subtraction? Yes, indeed. I've had lots of math and as far as I know negation and subtraction are the same thing. When you look at the definition for rings, and stuff like that, you will find that they are very different. If you look you will find that a - b is just shorthand for a + b'. where b' is the negative of b. So 0 - 5^2 is shorthand for 0 + (5^2)' There are more places where some programming languages do not give you what you thought they should do. Exponentiaton is an example. What is: a ^ b ^ c? There is not strict left to right rule in mathematics... You may wonder, why should I do a - b + c from left to right? Well, actually you have to transform it to something that is basic mathematics: a + (-b) + c and now it does not matter what way you do the operations. where (5^2)' is the negative of 5^2. -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131 home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/ |
#50
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
THIS IS NOT A BUG!!!!!
It's hard to say whether they "believed" you or not. You refused to say what the issue is/was. If you had described the issue, then no *knowledgeable* user of Excel would have believed you. As (I think) JE has pointed out, you can find Excel's order of evaluation of expressions in Help. You find the following in the topic "About Calculation Operators": Operator Description : (colon) (single space) , (comma) Reference operators – Negation (as in –1) % Percent ^ Exponentiation * and / Multiplication and division + and – Addition and subtraction & Connects two strings of text (concatenation) = < <= = < Comparison Now those may not be the rules you expected, BUT, that's irrelevant. I expected your "issue" would turn out exactly this way -- not an Excel bug, just documented behavior that differs from your expecatations. WRT damages, the EULA says "LIMITED WARRANTY FOR SOFTWARE PRODUCTS ACQUIRED IN THE US AND CANADA. Microsoft warrants that the SOFTWARE PRODUCT will perform substantially in accordance with the accompanying materials for a period of ninety (90) days from the date of receipt." Operator precedence is documented in those "accompanying materials", so Excel is performing as documented, and you have no grounds for a suit or for compensation. I DO think you may have an "issue" with your consultant. You could easily make the point that you have paid them to work with a product they aren't qualified to work with. If your consultant really knew Excel and how to debug formulas, he/she would have known to write the formula as =-(5^2). Presumably the consultant DID give you some sort of guarantee, no? You asked "What other surprizes await?!" If you used Help, you might not find so many surprises. On Tue, 03 Aug 2004 01:27:30 GMT, "fred" wrote: BOULDERDASH!!! This is a horrible bug in Excel (whereof I was previously unaware). It is very standard that exponentiaion takes precedence over negation. Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? Thank you sir! As another poster noted, M.P.E.P is a programming forum, but told that it violates math convention, they still argue. They probably just didn't believe me. Another said "much ado about nothing", but I think this is a horrible bug too. Excel should at least follow regular math conventions. What other surprizes await?! |
#51
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
What other surprises await?!
I'm sure there are many. If you are using Mm to help with equations...I think it has been discussed here before where the consensus is that Excel's interpreter operates in a kind of "left to right" only mode. So, with a function like: =2^3^4 Excel returns 4096 because it's grouping is "left associative." With Mm on the other hand, Power is "right associative." Therefo 2^3^4 returns: 2417851639229258349412352 I don't know if there's such a thing as a "Standard" here. One just has to be aware of them. And in either case, it is better to use () to clearly indicate meaning as others have mentioned. ( However, if I was a betting man, my money would be on Mm! I think I once read why this is so, but I can't find it at the moment.) :) Dana DeLouis "fred" wrote in message ... BOULDERDASH!!! This is a horrible bug in Excel (whereof I was previously unaware). It is very standard that exponentiaion takes precedence over negation. Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? Thank you sir! As another poster noted, M.P.E.P is a programming forum, but told that it violates math convention, they still argue. They probably just didn't believe me. Another said "much ado about nothing", but I think this is a horrible bug too. Excel should at least follow regular math conventions. What other surprizes await?! |
#52
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
Please site the standard that establishes the normal order for precedence.
As far as sorting, yes you should. -- Regards, Tom Ogilvy "fred" wrote in message ... You are 100% right! It sounds like he doesn't want to tell his client he wasted 1 week and 2000$ on something that simply can be found in the help. So the easy way out is to blame MS for everything. Welll... this is in my help (in Dutch) Operator Beschrijving - Negatief maken (zoals in -1) % Procent ^ Machtsverheffen * en / Vermenigvuldigen en delen + en - Optellen en aftrekken & Twee tekenreeksen aan elkaar koppelen = < <= = < Vergelijken As you can see, a negative sign has precendence over power. Unfortunately for Fred, a negative sign and a subtraction are typographically identical. There is only one good solution: using brackets. This is in my help too: Reference operators - Negation (as in -1) % Percent ^ Exponentiation * and / Multiplication and division + and - Addition and subtraction & Connects two strings of text (concatenation) = < <= = < Comparison But to me it's immaterial. Why don't they follow the normal mathematical order? If I'm going to sort a list of numbers should I be expected to look up the sort order to see if they deviated from the norm? No. |
#53
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
Given the ubiquity of Excel, it seems a bit silly for you to talk about a
"virtually universal" standard, isn't it? On Tue, 03 Aug 2004 02:28:09 GMT, "Stephen J. Herschkorn" wrote: Dik T. Winter wrote: In article "fred" writes: Do any of you SCI.MATH whizes want to weigh in on this? Well, contrary to some responders I do not read this in an excel newsgroup (I have no reason to read such a newsgroup...). MS Excel calculates "=-5^2" as 25, not as -25. Yes, that is one of the possibilities. Can you cite one publication, not a computer langauge manual, where the author computed -5^2 as 25? We are talking about the convention of the end user here. If you were helping a child with the school problem to plot y = -x^2, what you show him/her? The fact that there are some expressions (e.g., a^b^c) where precedence is not as standard does not negate that the standard of -x^2 is virtually universal. |
#54
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
If there is ANY possibility it could be ambiguous, he uses parentheses!
On Tue, 03 Aug 2004 02:34:01 GMT, "fred" wrote: So if a physicist writes an equation he has to include the 'rules of calculation' for others to use it? Give me a break. "Dik T. Winter" wrote in message ... In article "fred" writes: Do any of you SCI.MATH whizes want to weigh in on this? Well, contrary to some responders I do not read this in an excel newsgroup (I have no reason to read such a newsgroup...). MS Excel calculates "=-5^2" as 25, not as -25. Yes, that is one of the possibilities. This is because 'negation' is handled first in Excel. (!?) Right, there are quite a few programming languages that do the same. If you put a zero in the equation, as in "=0-5^2", your answer changes to -25. Indeed. Is this in line with standard math rules? Yup, both are in line with standard math rules. There are no standard rules about how unary operators are handled. Is negation different than subtraction? Yes, indeed. I've had lots of math and as far as I know negation and subtraction are the same thing. When you look at the definition for rings, and stuff like that, you will find that they are very different. If you look you will find that a - b is just shorthand for a + b'. where b' is the negative of b. So 0 - 5^2 is shorthand for 0 + (5^2)' There are more places where some programming languages do not give you what you thought they should do. Exponentiaton is an example. What is: a ^ b ^ c? There is not strict left to right rule in mathematics... You may wonder, why should I do a - b + c from left to right? Well, actually you have to transform it to something that is basic mathematics: a + (-b) + c and now it does not matter what way you do the operations. where (5^2)' is the negative of 5^2. -- dik t. winter, cwi, kruislaan 413, 1098 sj amsterdam, nederland, +31205924131 home: bovenover 215, 1025 jn amsterdam, nederland; http://www.cwi.nl/~dik/ |
#55
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
the unary negation operator is not the same as subtraction. A basic flaw
in your argument. Your mnenonic is incomplete. How would you express a negative number in an equation? the second flaw is that you attribute the syntax used in writing formulas in Excel to be synonymous to hand written formulas. But it isn't - it is a syntax defined by the authors of Excel. Excel defines a set of rules for its syntax which, to increase comfort, to a large extent parallels hand written formulas, but nonetheless, it is a syntax defined by the creators of excel. It is thus incumbent on the user to understand that syntax; not make assumptions. -- Regards, Tom Ogilvy "fred" wrote in message ... Well, yes, that is basically the same thing a couple of my friends said. But none of them are mathematicians. The only thing about it is that that's not how math/algebra/calculus/etc. is done. Negation and subtraction are one-in-the-same to the best of my somewhat-in-depth knowledge. There's even the mnemonic device "Please Excuse My Dear Aunt Sally" to help remember the order in which operations are supposed to be executed (Parenthesis, Exponents, Multipication, Division, Addition, Subtraction). To me the only valid argument, based on different priorities, is that non-math-people, when using actual numbers, not cell references, expected =-5^2 to be "negative five, squared". And they wanted to satisfy the secretaries and bean counters, not the heavy-duty math people. However, having done software development myself, I think it most likely that it's just a bug and just hasn't been fixed yet. In fact, to me, putting in a zero and getting a different answer proves it's wrong. "Alan" wrote in message ... "fred" wrote in message ... Are they rewriting math rules now? ... negation is different from subtracting? Indeed! Not in any math book I've ever seen. This is an interesting point. I guess I tend to view the two things as being separate and different in nature. Negation (in the sense that I believe you are using it above) such as turning +5 into -5 'creates' a new number. The value of that number is -5. Subtraction is an operation performed on one value with another. Therefore, subtracting +5 from a value is a different thing. I guess where this becomes important is in the example used elsewhere in this thread of: =-5^2 It could be argued that it is quite valid for either answer (+25 or -25) to be correct depending on whether we are squaring -5 or whether we are (implicitly) subtracting 5^2 from (the implicit) 0 that is not shown. If we put the zero in: =0-5^2 then I would suggest that the *only* valid interpretation is that we are subtracting 5^2 from zero, and thus the answer *must* be -25. Given that excel must have rules, it does not seem unreasonable for the algorithms to require an explicit subtraction, else go with the interpretation that we are squaring -5. Having said all of that, if we don't bother to use brackets to make the calculations completely explicit and unambiguous, then I guess we are each *choosing* to take the risk - whether we know it or not. Does my thinking sound reasonable? Alan. |
#56
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
I found a little more on this at:
http://www.macnauchtan.com/pub/precedence.html It says that many softwares don't comply with 'chalkboard' math rules. --------------------------------------------------------------------------- Microsoft Excel 4 CAUT[ion] Index A B C 1 2.0 2 numeric entry 2 = - A1^2 4 return is positive 3 = - A1^2 / 4 1 return is positive 4 = - + A1^2 4 return is +4 without error message Microsoft acknowledges the disconnect with chalkboard algebra for all versions of Excel calling it an "unexpected positive value" but argues that the result is correct because of their order of operations. The suggested workaround is to use prophylactic parentheses. ---------------------------------------------------------------------------- ---- Microsoft Excel 2001 CAUT[ion] Index A B C 1 2.0 2 numeric entry 2 =-A1^2 4 return is positive 3 =2 2 4 =5 5 5 = - A3^2 / (-A3^2-A4^2) - A4^2 / (-A3^2-A4^2) 1 return is positive 6 =(- A4^2 - A3^2) / (- A3^2 - A4^2) -1 return is negative The behavior is the same as Excel 4 but note that macros and user defined functions written in VBA work the opposite way. A user defined function avoids the unary minus interpretation just as, say, = - SQRT(A1) would. In the help documentation for Excel 2001 one finds, for the error function add-in, this definition: But what is that -t2? The kernel of the integral is exp(-t^2) and the reader is invited to make a plot of that. You will create a curve,which has value 1 at t = 0 and increases exponentially at each side. It's a far cry from the infamous Bell Curve that is the correct Gaussian form for the error function. One needs to call out exp(0-t^2) or exp (-(t^2)) in Excel. |
#57
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
Lance Lamboy wrote:
.... I checked my copy of oocalc. (I don't use M$ products.) Much to my chagrin it exhibited the same Excel bug. Historically speaking, I wouldn't put the blame on Microsoft. You can download a working copy of the original release of VisiCalc from http://www.bricklin.com/history/vcexecutable.htm and verify that it worked the same way. I presume that all subsequent versions of VisiCalc used the same order of operator precedence to avoid breaking existing applications. I do not have access to a version of Lotus, but I presume that they utilized the same order of operator precedence to make it easier for people to switch from VisiCalc to Lotus. MS probably adopted the same design decision for the same reason, when they competed with Lotus (just as they preserved the Lotus mistake of considering 1900 to be a leap year). The 1900 Leap Year is clearly wrong, but it would have created far more problems if dates did not import correctly from Lotus spreadsheets, than to keep existing aps working and warn users that the date system included a nonexistent date. However, to call clearly documented operator precedence decisions a "bug" stretches the definition considerably, since precedence is a just a convention that attempts to resolve ambiguous expressions. If you are that concerned about it, then don't write ambiguous expressions -- that is what parentheses are for. Jerry |
#58
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"Tom Ogilvy" wrote...
Precedence of operations is stated in the help. As far as I know, there is no universally accepted order of precedence that covers all combinations and permutations. .... Somewhat of a tangent. APL and its descendants (APL2, J and K) have sepaate tokens for numeric sign and minus operator. The numeric sign character is part of the number token, so effectively always binds tighter than any other token or operator. Evaluation is always right to left, so different results are produced when using the sign character vs the minus operator followed by a number raised to an even power. Excel treats unary minus like APL's sign character rather than like APL's unary ('monadic') minus. This is unlike most other programming languages that use the same character to represent signs in numeric tokens and unary and 'diadic' minus. |
#59
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
and some more at:
http://aah.ryan-usa.com/node27.html It is worth mentioning that some alternative order of operations agreements actually do give unary operators higher precedence than binary operators. One example of such an agreement is the one implemented in Microsoft Excel (http://support.microsoft.com/support...q132/6/86.asp). I happen to have Excel 2000 at present, and it does in fact evaluate -1^2 to 1 --something I personally would not have believed before preparing this article. |
#60
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"fred" wrote...
.... This is in my help too: Reference operators - Negation (as in -1) % Percent ^ Exponentiation * and / Multiplication and division + and - Addition and subtraction & Connects two strings of text (concatenation) = < <= = < Comparison But to me it's immaterial. Why don't they follow the normal mathematical order? If I'm going to sort a list of numbers should I be expected to look up the sort order to see if they deviated from the norm? No. You may not like this, but this'll GUARANTEE you get didly squat from Microsoft. They made NO SECRET of their operator precedence. That you and your consultant FAILED to read Excel's documentation and simply ASSUMED that Excel should work the way you expected it to is YOUR OWN FAULT! Also, this has been discussed time & time again in the Excel newsgroups, so it ain't new and there's no bounty you can expect for 'discovering' this. This one's 6 years old. http://groups.google.com/groups?selm...0toshiba-tecra This one's 9 years old. http://groups.google.com/groups?selm...rockwell.c om Whether you care to believe it or not, your expensive exercise with your consultant is nothing more than the price of ignorance. |
#61
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
with all the input from people like you this has become quite an interesting
thread. It takes me back to the thousands of hours I spent programming for a bank, and looking up the minute details of certain functions and running dozens of test routines to check behaviour of functions. It's really quite amazing how when you push something to its limits you find all kinds of quirky things. "Harlan Grove" wrote in message ... "Tom Ogilvy" wrote... Precedence of operations is stated in the help. As far as I know, there is no universally accepted order of precedence that covers all combinations and permutations. ... Somewhat of a tangent. APL and its descendants (APL2, J and K) have sepaate tokens for numeric sign and minus operator. The numeric sign character is part of the number token, so effectively always binds tighter than any other token or operator. Evaluation is always right to left, so different results are produced when using the sign character vs the minus operator followed by a number raised to an even power. Excel treats unary minus like APL's sign character rather than like APL's unary ('monadic') minus. This is unlike most other programming languages that use the same character to represent signs in numeric tokens and unary and 'diadic' minus. |
#62
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
Whether you care to believe it or not, your expensive exercise with your
consultant is nothing more than the price of ignorance. you are right sir. the only mystery to me is why it still exists. After reading all these posts and searching on my own I now see that "computer math" can diverge from from "classroom math" on these issues. I consider it sad but not terribly surprising. I admit to ignorance of the quirks, but don't admit that it's okay. Why don't many of the softwares work like a math major would expect? ... Probably because the developers/project managers weren't math majors. If the program as the subject of discussion were an English language program, would it be okay for a program to be making up its own rules of grammer? If the developers and project managers were not English majors we'd get the same thing as with the math rules. Would that be okay with you? Ignorance -- I hope you meant "not knowing", not "being an idiot." |
#63
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"fred" wrote...
Well, yes, that is basically the same thing a couple of my friends said. But none of them are mathematicians. The only thing about it is that that's not how math/algebra/calculus/etc. is done. Negation and subtraction are one-in-the-same to the best of my somewhat-in-depth knowledge. . . . Not necessarily. In the very technical sense, 'negation' means taking the additive inverse of an element of an algebraic ring. In the standard high level development of algebra, there is no subtract/minus, only adding the additive inverse of what would be the subtrahend in arithmetic subtraction. So x - y would always be x + -y. Arithmetic subtraction may be defined in term of addition and negation, but negation is definitely a more fundamental concept. . . . There's even the mnemonic device "Please Excuse My Dear Aunt Sally" to help remember the order in which operations are supposed to be executed (Parenthesis, Exponents, Multipication, Division, Addition, Subtraction). So? This is a convention, not an immutable universal truth. To me the only valid argument, based on different priorities, is that non-math-people, when using actual numbers, not cell references, expected =-5^2 to be "negative five, squared". And they wanted to satisfy the secretaries and bean counters, not the heavy-duty math people. Guess what?! Excel IS NOT MATHEMATICAL SOFTWARE like Maple, Mathematica, MathCAD, MatLab, etc. It's a SPREADSHEET! It's meant for secretaries and bean counters, and if others (mis)use it as mathematical software, THEY HAVE NO ONE BUT THEMSELVES TO BLAIM WHEN IT DOESN'T WORK AS 'EXPECTED'. However, having done software development myself, I think it most likely that it's just a bug and just hasn't been fixed yet. In fact, to me, putting in a zero and getting a different answer proves it's wrong. No. Putting a zero in front of it converts the unary/monadic negation operator into a diadic suntraction operator. It's parsed FUNDAMENTALLY DIFFERENTLY. Even if unary minus had lower priority than exponentiation, it'd still be parsed differently. Maybe you think you've done software development, but you don't seem to know much about language design or parsing. Given the fun discussions that infrequently occur with regard to different decimal points and digit groupings in non-English speaking and non-European countries, are you sure all math texts in all languages adopt the exact same operator precedence? |
#64
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"Stephen J. Herschkorn" wrote...
.... Stating it is a documented convention is not a legitimate argument. .... Rubbish! Ignorance of any program's specs is begging for trouble. That said, once done, something like this can't be undone. The damage 'fixing' this would cause to those more practical individuals who read the specs and have designed their spreadsheet accordingly would be far greater than helping out those who are incapable of addressing their own ignorance. As I've written elsewhere in this thread, if you want math software, use REAL math software. If you use Excel, realize it ISN'T math software. It's an overgrown calculator. And as a calculator, the unary minus in Excel is treated NO DIFFERENTLY than the [CHS] button on any HP RPN calculator or the [+/-] button on any TI calculator. The HP sequence 3 [CHS] 2 [x^y] returns 9. The TI sequence 3 [+/-] [x^y] 2 [=] returns 9. The Excel formula =-3^2 returns 9. Once you adopt the correct perspective, this ceases to be a problem. |
#65
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
Guess what?! Excel IS NOT MATHEMATICAL SOFTWARE like Maple, Mathematica,
MathCAD, MatLab, etc. It's a SPREADSHEET! It's meant for secretaries and bean counters, and if others (mis)use it as mathematical software, THEY HAVE NO ONE BUT THEMSELVES TO BLAIM WHEN IT DOESN'T WORK AS 'EXPECTED'. (Blame, not blaim) If there isn't "math" to base it on, what is there? However, having done software development myself, I think it most likely that it's just a bug and just hasn't been fixed yet. In fact, to me, putting in a zero and getting a different answer proves it's wrong. No. Putting a zero in front of it converts the unary/monadic negation operator into a diadic suntraction operator. It's parsed FUNDAMENTALLY DIFFERENTLY. Even if unary minus had lower priority than exponentiation, it'd still be parsed differently. Maybe you think you've done software development, but you don't seem to know much about language design or parsing. "Maybe you think you've done software development" ... okay, whatever, that's kind of unjustifiably condescending, but I'm not sure what your point is. I haven't done language design. no. Why shouldn't a language calculate equations in the way a calculus teacher would? ... Apparently they just don't. I'm guessing it's because the programmers don't know the right way to do it, because most programmers aren't mathematicians; or because there would be too much work involved at any given point in the project. Why else? Given the fun discussions that infrequently occur with regard to different decimal points and digit groupings in non-English speaking and non-European countries, are you sure all math texts in all languages adopt the exact same operator precedence? I guess that any formula in any physics journal is univerally calculable. Yes. If you have to pick a software and then look up its idiosyncracies instead of assuming it follows math convention, then I suppose you are right. Is this right? I say 'no'. Is it common? I guess it is relativly so. |
#66
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"Jerry W. Lewis" wrote...
Lance Lamboy wrote: ... I checked my copy of oocalc. (I don't use M$ products.) Much to my chagrin it exhibited the same Excel bug. Historically speaking, I wouldn't put the blame on Microsoft. You can download a working copy of the original release of VisiCalc from http://www.bricklin.com/history/vcexecutable.htm and verify that it worked the same way. I presume that all subsequent versions of VisiCalc used the same order of operator precedence to avoid breaking existing applications. I do not have access to a version of Lotus, but I presume that they utilized the same order of operator precedence to make it easier for people to switch from VisiCalc to Lotus. . . . And you'd be wrong! In 123, -3^2 returns -9. . . . MS probably adopted the same design decision for the same reason, when they competed with Lotus (just as they preserved the Lotus mistake of considering 1900 to be a leap year). .... While Lotus is unquestionably to blame for the 1900-as-leap-year bug, Microsoft actually chose to have Excel behave DIFFERENTLY than 123 in the beginning. Now in the beginning there was only Excel for the Mac, and 123 only existed for 8086/8-based PCs, so there may have been no perceived need for Excel to duplicate 123's operator precedence. However, once established in the Mac world, it would have become a practical impossibility to do anything different on PCs. Microsoft gets all the credit/blame for aping VisiCalc rather than 123. Posted Via Nuthinbutnews.Com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.nuthinbutnews.com |
#67
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
Stephen J. Herschkorn wrote:
fred wrote: Do any of you SCI.MATH whizes want to weigh in on this? MS Excel calculates "=-5^2" as 25, not as -25. This is because 'negation' is handled first in Excel. (!?) If you put a zero in the equation, as in "=0-5^2", your answer changes to -25. Is this in line with standard math rules? Is negation different than subtraction? I'm getting a lot of comments in the Excel NG basically saying that "it's in the help section, so too bad". I've had lots of math and as far as I know negation and subtraction are the same thing. Alan Beban wrote: Well, this is an Excel forum, so one should expect a programming point of view. But if you search on mathematical notation generally, I think negation is viewed as a unary operator, while subtraction is viewed as a binary operator; and the discussions are not much clearer in that context. My own view, not as a mathematician, is that the issue revolving around how to evaluate -1^2 depends on some *order of precedence*, and is totally conventional as to negation and exponientation. BOULDERDASH!!! This is a horrible bug in Excel (whereof I was previously unaware). It is very standard that exponentiaion takes precedence over negation. Ask any semi-decent high school student to draw a graph of y = -x^2, and what will you get? Stating it is a documented convention is not a legitimate argument. What if Microsoft(R) buried in its documentation that addition takes precedence over multiplication? That the spell checker would always change word "friend" to "freind"? That the sum function adds only every other term? That using a "q" in one of its products would cause the system to reboot? These effects would be just as valid by this logic. I have sent this comment to Microsoft(R), though I expect no good to come of it. Pounding on the desk about it being "very standard that exponientation takes precedence over negation" is much less persuasive than would be citing the "standard" order of precedence rules applicable in mathematics. I don't find what "a semi-decent high school student" would do to be very compelling. Why can't the people who are so emotional about the issue (which, incidentally, seems to have been resolved in C the same way as it is in Excel, which is hard to blame Microsoft for) cite some persuasive authority besides the fact that their grandmother taught them to Please Excuse My Dear Aunt Sally, which my limited Google search suggests is applicable to only the binary operators listed and not to unary operators? Maybe we could all learn something if we were directed to an authoritative source of the convention in ordinary mathematics without regard to programming. Alan Beban |
#68
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"JE McGimpsey" wrote...
.... There's no ambiguity that negation and subtraction are different. The fact that the typography is ambiguous means that you need to check your assumptions. That's the real problem here. The character - is being used both as a sign character and as an operator. The apparent goal is consistency of results for, say, -3^2 and -A1^2 when A1 == 3. Excel's results are consistent: both return 9. FWLIW, Lotus 123's results are also consistent: both return -9. The consistency of results is what's important, not the precedence. While this isn't a bug, it was at best a questionable design decision. Those who insist that a computer application must conform to *their* standard have never programmed in APL. The only language I know for which this isn't ambiguous because different characters are used for negative sign on the one hand (part of the number token) and monadic/diadic minus on the other. PITA to use if you cling to any preconceived notions of left-to-right evaluation, but NEVER ambiguous. Actually that's unfair to C and Logo (and probably most other functional languages). C and Logo don't have exponentiation operators, just power functions, so again no ambiguity. Posted Via Nuthinbutnews.Com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.nuthinbutnews.com |
#69
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"Dik T. Winter" wrote...
.... When you look at the definition for rings, and stuff like that, you will find that they are very different. If you look you will find that a - b is just shorthand for a + b'. where b' is the negative of b. So 0 - 5^2 is shorthand for 0 + (5^2)' .... I don't recall exponentiation being covered in the development of either rings or fields. Just addition and multiplication and their respective inverses. Exponentiation wasn't brought up until polynomials were introduced. Also, you're now arguing for both interpretations. If 5^2 = 25, 0 + (5^2)' = 0 + (25)' = 25' = -25 rather than 25. That's the nub of this whole argument. Posted Via Nuthinbutnews.Com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.nuthinbutnews.com |
#70
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"fred" wrote...
.... Ignorance -- I hope you meant "not knowing", not "being an idiot." Yes. I admit to my own ignorance from time to time. There's nothing wrong with ignorance as long as it's addressed once discovered. Now, elsewhere in this thread I mentioned that Excel really isn't mathematical software but an overgrown calculator, and Excel's unary minus operator works like HP [CHS] or TI [+/-] keys when pressed before their respective [x^y] keys. FWIW, that's the best mnemonic I can offer. However, if you want to avoid ambiguity at the cost of some loss of flexibility, use Excel's POWER function instead of the ^ operator. Does the same thing without ambiguity. |
#71
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"fred" wrote...
.... . . . It's really quite amazing how when you push something to its limits you find all kinds of quirky things. .... Excel is full of, to be charitable, quirks. See this other thread too. http://groups.google.com/groups?selm...g .google.com |
#72
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"Alan Beban" wrote...
.... . . . (which, incidentally, seems to have been resolved in C the same way as it is in Excel, which is hard to blame Microsoft for) .... What are you talking about?! Unless you mean to recommend that Excel users stop using the ^ operator and use the POWER function instead, Excel and C don't work the same. C lacks an exponentiation operator. It includes a function named pow in its standard library. It has a ^ operator, but it's bitwise XOR. Posted Via Nuthinbutnews.Com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.nuthinbutnews.com |
#73
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"Dik T. Winter" writes:
There are more places where some programming languages do not give you what you thought they should do. Exponentiaton is an example. What is: a ^ b ^ c? Some programming languages don't even treat that as exponentiation. And not all of those treat it as bitwise XOR. There is not strict left to right rule in mathematics... There isn't even strict lexing in mathematics -- is 3 followed by a raised dot, followed by 14, an approximation to pi, or the answer to life, the universe and everything? Convention, convention, and convention. Phil -- 1st bug in MS win2k source code found after 20 minutes: scanline.cpp 2nd and 3rd bug found after 10 more minutes: gethost.c Both non-exploitable. (The 2nd/3rd ones might be, depending on the CRTL) |
#74
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"Myrna Larson" wrote...
Given the ubiquity of Excel, it seems a bit silly for you to talk about a "virtually universal" standard, isn't it? .... Your argument is akin to saying not everyone drives on the right hand side of the road in the US if you choose not to. The failure of some individuals to adhere to standards (something Microsoft has developed quite a reputation for doing, er, not doing) doesn't alter the existence of standards, only their enforceability. However moot since you've deleted sci.math from the newsgroup to which you sent your response. The person to whom you responded is likely never to see your response. |
#75
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"fred" wrote...
.... Why shouldn't a language calculate equations in the way a calculus teacher would? ... Apparently they just don't. I'm guessing it's because the programmers don't know the right way to do it, because most programmers aren't mathematicians; or because there would be too much work involved at any given point in the project. Why else? .... Maybe because computers aren't usually working with equations or true real (or complex) numbers. Computers generally deal with finite precision binary arithmetic calculations, and those have complications that have ensnared many mathematicians who don't appreciate the difference. For instance, binary floating point addition and multiplication are both commutative, as expected, but neither is strictly associative, only approximately so. Evaluation order using the same operator is critical in software development and usually not at all in mathematics. |
#76
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"fred" wrote in message ... I did in another sub-thread. Dana was familiar with it already. If you lead off with a negative sign it uses the negative value inside the exponentiation. So, instead of =-5^2 equalling -25 it equals 25. but, =0-5^2 is calculated correctly as -25 even though it's mathematically the same. The error is yours The standard parsing of =-5^2 is -5 * -5 multiplying 2 negative numbers always gives a positive The acronym to remember is BODMAS What you should have specified is =-(5^2) Keith ----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups ---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =--- |
#77
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
Harlan Grove wrote:
"Jerry W. Lewis" wrote... Lance Lamboy wrote: ... I checked my copy of oocalc. (I don't use M$ products.) Much to my chagrin it exhibited the same Excel bug. Historically speaking, I wouldn't put the blame on Microsoft. You can download a working copy of the original release of VisiCalc from http://www.bricklin.com/history/vcexecutable.htm and verify that it worked the same way. I presume that all subsequent versions of VisiCalc used the same order of operator precedence to avoid breaking existing applications. I do not have access to a version of Lotus, but I presume that they utilized the same order of operator precedence to make it easier for people to switch from VisiCalc to Lotus. . . . And you'd be wrong! In 123, -3^2 returns -9. Interesting and surprising. Thanks for the information. Jerry |
#78
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
"Harlan Grove" writes:
"Alan Beban" wrote... ... . . . (which, incidentally, seems to have been resolved in C the same way as it is in Excel, which is hard to blame Microsoft for) ... What are you talking about?! Unless you mean to recommend that Excel users stop using the ^ operator and use the POWER function instead, Excel and C don't work the same. C lacks an exponentiation operator. It includes a function named pow in its standard library. It has a ^ operator, but it's bitwise XOR. He probably means that unary minus has a significantly higher precedence than subtraction, so much so that it has a strictly higher precedence than at least one operator that one would commonly view as being of a strictly higher precdence than subtraction. Therefore there is a concrete example of an expression which is interpretted differently in C than it would be using people like you's conventions. In C's case, the precedence inversion is with the multiplicative family of operators. e.g. compare C's interpretation of -2%3 as (-2)%3 rather than -(2%3). Simple, eh? Barely need for an interrobang. Phil -- 1st bug in MS win2k source code found after 20 minutes: scanline.cpp 2nd and 3rd bug found after 10 more minutes: gethost.c Both non-exploitable. (The 2nd/3rd ones might be, depending on the CRTL) |
#79
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel Math Bug
"Jerry W. Lewis" wrote in message ...
Amedee Van Gasse wrote: Programmers are responsible for learning the languages that they use. It is a bit more problematic when one person provides the formulas (or even the code) and another implements it, but that is what testing is for. Right. You've got to blame the person who was responsible for testing. I once got burned providing an algorithm that someone else then implemented in a flavor of Basic that evaluated strictly left to right with no algebraic hierarchy (other than parentheses) at all. I was irritated that someone would write a language that worked that way, but they documented how it worked, so our ignorance of their documentation was not their fault. Fred's consultant should have known better than to imply that any developer could be sued for producing a package that operated as documented. Fred's consultant immediately blamed Microsoft in order not to be blamed himself. Jerry |
#80
Posted to microsoft.public.excel.programming,sci.math
|
|||
|
|||
Excel Math Bug
On Tue, 03 Aug 2004 00:59:10 -0700, Alan Beban wrote:
Pounding on the desk about it being "very standard that exponientation takes precedence over negation" is much less persuasive than would be citing the "standard" order of precedence rules applicable in mathematics. I don't find what "a semi-decent high school student" would do to be very compelling. Why can't the people who are so emotional about the issue (which, incidentally, seems to have been resolved in C the same way as it is in Excel, which is hard to blame Microsoft for) cite some persuasive authority besides the fact that their grandmother taught them to Please Excuse My Dear Aunt Sally, which my limited Google search suggests is applicable to only the binary operators listed and not to unary operators? Maybe we could all learn something if we were directed to an authoritative source of the convention in ordinary mathematics without regard to programming. By the definition of unary minus, -x^2 is the number such that x^2 + (-x^2) = 0. What is the derivative of -x^2 with respect to x? What is the slope of the tangent line at x = 1? Is it positive or negative? What is the integral of -x^2 from x = 0 to 1? Is it positive or negative? -- Dave Seaman Judge Yohn's mistakes revealed in Mumia Abu-Jamal ruling. <http://www.commoncouragepress.com/index.cfm?action=book&bookid=228 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Less Excel more Math | Excel Worksheet Functions | |||
Math functions in Excel | Excel Discussion (Misc queries) | |||
Excel math formula | Excel Worksheet Functions | |||
How do I ? math/excel question | Excel Discussion (Misc queries) | |||
More math than excel, but a fun problem | Excel Worksheet Functions |