Hello to all,
I have found a fancy behavior of Calc but I cannot decide whether it is
a bug or a "feature". Hence I was looking for your advice before posting
a bug report (if required).
1. Open LO Calc
2. In A1 enter formula "=1-2^2" and press enter key
The result shown is -3 which is ok since
1-2² = 1-(2²) = 1-4 = -3
3. In A2 enter formula "=-2^2" and press enter key
I would expect this to be treated as -2² = -(2²) = -4
But Calc considers it as (-2)² = +4
Quite obviously, a work around is to define the formula as
"=-(2^2)" which indeed returns -4
I've checked the wiki page dedicated to operators [1] but it does not
give much information on operator precedence.
For me, either we should have both 1-2^2 = 1+4 = 5 and -2^2 = +4
Or we should have both 1-2^2 = 1-4 = -3 and -2^2 = -4
However, perhaps some of you have a different view point on the matter ?
In other words, is that a bug or is it perfectly normal ?
Of course changing such behavior will cause a hell lot of trouble in
existing documents… but perhaps the operator precedence should be
explicitly specified on the wiki ?
Tested both on LO 5.1.0.3 and on LO 4.2.8.2 (build ID 420m0(Build:2)).
Cheers,
Gaël Lorieul