Bug 106921 - Calculation of -$A1^(any even power (0,2,4,6,8...)) in formula comes out incorrectly positive.
Summary: Calculation of -$A1^(any even power (0,2,4,6,8...)) in formula comes out inco...
Status: RESOLVED DUPLICATE of bug 74525
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.2.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-02 23:19 UTC by Stamatis
Modified: 2021-05-24 07:51 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stamatis 2017-04-02 23:19:22 UTC
Description:
If I assign the value 1 to a cell, e.g. A1 and type in another cell the simple formula: =-$A1^2 the value returned is 1, where it should be -1, as the squaring of the cell should take precedence over the negation.

It seems that the minus (-) outside of the cell is moved into the cell before calling the square function.

If on the other hand I type the formula as =-($A1^2), then I get the correct -1 value.



Steps to Reproduce:
1. Type the number 1 in any cell, C3 for instance
2. Go to a different cell and type the formula: =-$C3^2, or =-$C3^4 or to any even power.
3. The result displayed will be incorrectly 1 (it should be -1)

Actual Results:  
Using any number in any cell, when handled by this formula: =-$Cell^(any even power) will give incorrectly a positive result.

As mentioned above, if the formula is instead typed as =-($Cell^2) - note the () around the Cell - the correct result (negative) is returned.

Expected Results:
The expected result from this formula, given the above conditions, should always be negative, as any number raised to an EVEN power becomes positive, therefore will be turned negative due to the minus sign outside of the cell.


Reproducible: Always

User Profile Reset: Yes

Additional Info:
It seems that the minus (-) outside of the cell is moved into the cell before calling the square function. This is not correct mathematically, as raising the cell value to a power should take precedence over the negation of the value in a cell.


User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36
Comment 1 Xisco Faulí 2017-04-03 09:57:06 UTC
Hello Stamatis,
I think this is the expected behaviour and you need to use the parenthesis in order to convert the value to negative. Same behaviour seen in MSO Excel 2010
Closing as RESOLVED NOTABUG
Comment 2 Timur 2021-05-24 07:51:19 UTC

*** This bug has been marked as a duplicate of bug 74525 ***