Bug 128870 - Unary minus ('-') precedence
Summary: Unary minus ('-') precedence
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-11-18 10:53 UTC by andrecbarros
Modified: 2022-09-01 03:48 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 andrecbarros 2019-11-18 10:53:41 UTC
Description:
The unary minus ('-') is taking precedence over exponentiation ('^') on basic (vb?) evaluation.

To see it, create a macro module and insert:
-(1#/2)^2
on it.

The result value will be 0.25. On Excel it gives -0.25.


Steps to Reproduce:
1. Insert "somevar = -(1#/2)^2" inside a macro module
2. eval it.
3.

Actual Results:
0.25

Expected Results:
-0.25


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Srirupa 2019-11-26 05:39:30 UTC
Hi
Thank you for reporting the issue.I can confirm that the issue is present in the below version.

Version: 6.3.2.2
Build ID: 98b30e735bda24bc04ab42594c85f7fd8be07b9c
CPU threads: 4; OS: Mac OS X 10.13.4; UI render: default; VCL: osx; 
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

The below VBA macro in Libre gives the result as 0.25 , whereas in MS Excel it gives the result as -0.25 

REM  *****  BASIC  *****

Sub Main
DIM Variable_One As Double
Variable_One=-(1#/2)^2
MsgBox Variable_One
End Sub

Thanks
Srirupa
Comment 2 Xisco Faulí 2019-12-02 16:21:19 UTC
Also reproduced in

LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 3 QA Administrators 2022-09-01 03:48:02 UTC
Dear andrecbarros,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug