[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: OASIS: Infix Operator "^"
On Thu, 2007-22-02 at 21:09 +0200, Leonard Mada wrote: > Chapter 6.3.5 of the OASIS OpenFormula document (version 2007-02-14) > describes the Infix Operator (^). > > However, it contains a lot of mathematical ERRORS: Considering that the document contains definitions there is no claim that the terms match what others may define. Unfortunately there is a significant discrepancy of the normal mathematical definitions and what is used in spreadsheets. In any case, OpenFormula describes the syntax used in a file. There is no absolute requirement that this is what the user sees. As noted below, Gnumeric includes aditional parentheses in case were precedence is unexpected. [Of course there is an issue here: in OOo ^ appears to be left-associative while in Gnumeric it is right-associative.] > > 1. “^” is left-associative, not right-associative!!! Wherever I look I find that ^ is indeed right-associative contrary to your claim. Of course this does nean that =2^3^2 should return =2^(3^2) = 512 not 64. > Therefore: =2^3^2 should return =2^(3^2) = 512 and NOT 64 !!! The second > "^" left associates with "3", so first "3" gets squared and thereafter > the first "2" gets to the power 9. > > 2. The classic ERROR: -4^2 > Mathematically, this yields always -(4^2)=-16, NEVER +16!!! > There is NO unary operator in mathematics that converts a number to its > negative, like described in the documents. This is utter nonsense. Of course there is such a unary operator. How else is - (x^2+1) to interpret. Pick any universal algebra text, look for unary operators and you will likely find the negation operator as an example. Personally I don't care whether -4^2 in an odf file means (-4)^2 or -(4^2) as long as the user is not exposed to -4^2 with the former meaning. Unfortunately in Excel-land the -4^2 is interpreted as (-4)^2. By the way, if you were right that there is no unary negation operator that the only way to interpret -4^2 would be as the square of the negative number -4 rather than the negation of the square of 4. > I would suggest consulting a > dedicated mathematical program. As stated in issue > http://www.openoffice.org/issues/show_bug.cgi?id=66735 on the OOo website: > *Mathematica* v5.(x) returns -16 > *R* v2.4.0 returns -16 > other software (like Scilab, maxima, octave, as pointed in that Calc > issue) report -16, too. > > gnumeric takes an interesting approach: it converts the first expression > to =(-4)^2, which indeed is then +16. So, this last is mathematically > correct and, at the same time, users who know a bit more about > mathematics, recognize that gnumeric did NOT calculated what they > expected. (it is transparent what has happened) > > Stating however, that -4^2 = +16 is plain wrong!!! And inventing various > mathematical rules that break the old ones is really NOT good for a > standard. And inventing a syntax that break what historically has been done in the field (in this case in spreadsheets) isn't good for a standard either. Andreas -- Prof. Dr. Andreas J. Guelzow Dept. of Mathematical & Computing Sciences Concordia University College of Alberta
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]