https://bugs.documentfoundation.org/show_bug.cgi?id=146915

Mike Kaganski <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |NOTABUG
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Mike Kaganski <[email protected]> ---
This is not a bug.
Your A2 contains a *number* (manually formatted to left-align). LEFT(B4)
returns a string. An equality operator returns FALSE when comparing strings
with numbers, and that is the correct behavior: '="4"=4' must return FALSE; see
ODF standard's 6.4.7 Infix Operator "=" [1] requiring that behavior explicitly.

However, when you calculate '="4"-4=0', you first perform negation, which uses
implicit conversion (documented in 6.3.5 Conversion to Number [2]). Note how
it's implementation-defined if strings get converted to numbers; and Calc
follows all major spreadsheet software in converting the strings here. So "4"
gets converted to 4, the negation is calculated, numeric result is 0, and it
correctly compares as equal to 0.

Whenever you use text functions, and use their results in numeric calculations,
you must convert the string to number directly to avoid confusion. Use e.g.
VALUE function [3]. 

[1]
https://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part4-formula.html#Infix_Operator_EQ
[2]
https://docs.oasis-open.org/office/OpenDocument/v1.3/OpenDocument-v1.3-part4-formula.html#ConversionToNumber
[3]
https://help.libreoffice.org/latest/en-US/text/scalc/01/04060110.html?DbPAR=CALC#bm_id3150802

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to