# Re: OASIS: Infix Operator "^"

• From: John Machin <sjmachin lexicon net>
• To: Leonard Mada <discoleo gmx net>
• Cc: gnumeric-list gnome org
• Subject: Re: OASIS: Infix Operator "^"
• Date: Fri, 23 Feb 2007 09:41:09 +1100

```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:

```
```[snip]
```
```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 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.
```
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).
```
HTH,
John

```