Description: If I wrote a negative sign at the beginning of the formula in a cell, the result is unnatural. Steps to Reproduce: 1. The value in the cell A1 to be 1. 2. The value in the cell A2 to be 2. 3. The formula in the cell A3 to be "=-A1^2+A2^2" Actual Results: 5 Expected Results: 3 Reproducible: Always User Profile Reset: No Additional Info: Version Information: Version: 25.2.3.2 (AARCH64) / LibreOffice Community Build ID: bbb074479178df812d175f709636b368952c2ce3 CPU threads: 8; OS: macOS 15.5; UI render: Skia/Raster; VCL: osx Locale: ja-JP (ja_JP.UTF-8); UI: ja-JP Calc: threaded Additional Information: - If the formula in cell A3 was refined as "=A2^2-A1^2", the result changed to 3 correctly. - Same behavior was occured also in Ver. 24.8.4.2 (X86_64).
The minus may be either a binary operator (as in your second expression), or unary (as in first). They are different, and have different precedence. An unary minus is applied to the number, not to the result of raising to a power, so your first expression is equivalent to "(-A1)^2+A2^2". That is defined in the standard, so not a bug. However, that is not obvious; there is a request to make such expressions to auto-parenthesise, to remove ambiguity. *** This bug has been marked as a duplicate of bug 114929 ***
(In reply to Mike Kaganski from comment #1) > The minus may be either a binary operator (as in your second expression), or > unary (as in first). They are different, and have different precedence. An > unary minus is applied to the number, not to the result of raising to a > power, so your first expression is equivalent to "(-A1)^2+A2^2". That is > defined in the standard, so not a bug. However, that is not obvious; there > is a request to make such expressions to auto-parenthesise, to remove > ambiguity. > > *** This bug has been marked as a duplicate of bug 114929 *** Thank you, Mr. Mike! I've gut it.