Issue 66735 - amend brackets for inputs starting with number with algebraic sign
Summary: amend brackets for inputs starting with number with algebraic sign
Status: CLOSED DUPLICATE of issue 26755
Alias: None
Product: Calc
Classification: Application
Component: viewing (show other issues)
Version: recent-trunk
Hardware: All All
: P5 (lowest) Trivial with 6 votes (vote)
Target Milestone: ---
Assignee: requirements
QA Contact: issues@sc
Depends on:
Reported: 2006-06-26 07:24 UTC by Rainer Bielefeld
Modified: 2013-08-07 15:12 UTC (History)
2 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Bielefeld 2006-06-26 07:24:03 UTC
In issue 24271 we found out that there seems to be some worrying concerning
correct interpretation of mathematical expressions starting with and only
containing an operation with a single number with algebraic sign like '=-2^4'
and similar. This would be more clearly if OOo would change that input '=-2^4'
to '=(-2)^4'
Comment 1 frank 2006-07-13 10:54:38 UTC
IMHO not a practicable way and unnecessary as the minus in '=-4^2' can't be
anything else as a simple marker for a negative number, so the result is
absolutly correct.
Comment 2 lcn 2006-08-10 17:42:13 UTC
IMHO, If auto change (like Gnumeric), the input =-4^2 should be automatically
change to =-(4)^2, following math software (R, Scilab, maxima,...) that result -16.
But in that case, all combination should be tested : -(4^2) ???...
Comment 3 lcn 2006-08-28 05:17:47 UTC
In Google, Have yous tried to type -4^2 ?
It resuts -(4^2) = -16.
Comment 4 discoleo 2006-10-26 23:32:53 UTC
Issue 24271 has been closed, but it is still a big BUG.

-4^2 = -16 !!! ALWAYS

Software, that does NOT conform to this is wrong.

You do not have in mathematics an "inverse sign" operator, therefore "-" is
really a minus before anything else.

* IF you want to raise the number "-4" to sqare, THEN you have to type: (-4)^2
* -4^2 = -(4^2) = -16
* -3! = -(3!)
* -x^2 = -(x^2) !!!!
** you never interpret -x^2 = (-x)*(-x) = x^2 !!!! FALSE

# the operators '^' AND '!' have highest left-side precedence (BUT NOT
right-sided, e.g. -2^3^4 = -2^(3^4)=-(2^(3^4)) )

R v2.4.0: -4^2 = -16
Octave v2.1.73: -4^2 = -16
(I will ask a collegue next week to test Mathematica, too)
Comment 5 discoleo 2006-11-09 11:20:06 UTC
I was told the results for *Mathematica* (v5.(x)):

It is as expected: -4^2 = -16 !!!

Mathematica is a reference program in mathematics, so this should be viewed as
written by the almighty. I do not have access to mathematica myself, but I am
confident that the person I asked, actually tested this (and did NOT tell me
what he thinks is correct).

As noted in a previous post, other mathematical software (like Scilab, maxima,
octave, R) interpret it the same way.

As I mentioned, you do *NOT* have an "inverse sign" operator in mathematics. "-"
is only the substraction. IF you want to specify the number "-4" you have to
type "(-4)" !!!! BASTA.

Why does gnumeric interpet it differently?

Interesting question and I believe the answer is as follows:
 # -4^2 = -16 AND NOT +16, which is wrong
 # BUT many spreadsheet users were used to get +16 in Excel,
 # so gnumeric let those users calculate what they expected,
 # BUT changed the syntax to be correct, so people NOT accustomed to this BUG
would know (and see) that it is NOT what they expect

So, I can only recommend that Calc adopts this same strategy. This way,
professionals can live with this bug, because Calc would tell them:
> when people who use this spreadsheet write =-4^2
> they usually mean =(-4)^2; so does Calc.
Comment 7 rcabane 2008-05-29 13:44:32 UTC
Here is the similar discussion for Gnumeric:
... with a sensible conclusion. Why wouldn't we do the same job ?
Comment 8 ooo 2008-06-02 14:26:26 UTC
Resolving this issue as duplicate of issue 26755 that now also has more details
and pointers. Please transfer your votes.

*** This issue has been marked as a duplicate of 26755 ***
Comment 9 ooo 2008-06-02 14:27:03 UTC
Closing dup.