Re: OASIS: Infix Operator "^"

On 23/02/2007 6:09 AM, 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:

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. I would suggest consulting a dedicated mathematical program. As stated in issue 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.

I hope this gets corrected.

IMextremelyHO: Anyone who attempts to rely on knowing what the precedence of operators is in any language -- apart from () */ and +- -- instead of putting () in the expression is just plain crazy.

It is a well known fact that language designers make arbitrary decisions about operator precedence. One of the more ludicrous cases is in Pascal and its inheritors: the () in "if (a < b) and (c < d)" are *necessary* Why? Because without the (), that would be interpreted as "if a < (b and c) < d", which would be valid only if all 4 variables were of Boolean type and < was a valid operator on Booleans (False < True, in an ideal world) but it's not so (in Pascal).


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]