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

            Bug ID: 174141
           Summary: ISLOGICAL returns FALSE for TRUE() assigned to a LET
                    variable
           Product: LibreOffice
           Version: 26.8.1.1 release
          Hardware: x86-64 (AMD64)
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Calc
          Assignee: [email protected]
          Reporter: [email protected]

ISLOGICAL(TRUE()) returns TRUE, but assigning TRUE() to a LET variable and
testing that variable with ISLOGICAL returns FALSE (displayed as 0 in the
stable versions tested).

Steps to reproduce:
1. Create a new Calc spreadsheet.
2. Enter the following formulas in separate cells. These examples use commas as
argument separators; use semicolons instead if required by your Calc settings.

   =ISLOGICAL(TRUE())
   =LET(a,TRUE(),ISLOGICAL(a))

Actual results:
The first formula returns TRUE.
The second formula returns FALSE, displayed as 0 in the stable versions tested.

Expected results:
Both formulas should return TRUE: assigning TRUE() to a name with LET should
preserve the information needed by ISLOGICAL to recognize it as a logical
value.

Reproducibility:
Always in the tested environments.

Additional observations:
In LibreOffice 26.2.6.3 and a 27.2 development build, a cell reference behaves
differently from a direct TRUE() expression:

   A1: =TRUE()
   B1: =LET(a,A1,ISLOGICAL(a))

B1 returns TRUE (displayed as 1 in the tested 26.2.6.3 build).
Also, =LET(a,TRUE(),IF(a,"yes","no")) returns "yes". This report concerns
logical-value detection, not a failure of ordinary conditional evaluation.

In the tested 27.2 development build, LAMBDA shows a similar difference:

   =LAMBDA(a,ISLOGICAL(a))(TRUE())   returns FALSE
   =LAMBDA(a,ISLOGICAL(a))(A1)       returns TRUE, with A1 containing =TRUE()

LAMBDA is not available in the stable versions discussed here; the
stable-version reproduction uses LET only.

Documentation:
The LET help describes assigning names to calculation results and values:
https://help.libreoffice.org/latest/en-US/text/scalc/01/func_let.html

The ISLOGICAL help says it returns TRUE for a logical value and FALSE
otherwise:
https://help.libreoffice.org/latest/en-US/text/scalc/01/04060104.html

I could not find a documented exception for logical values assigned to LET
variables. I understand that Calc can represent logical values using numbers
and logical number formats; I am not reporting ISNUMBER(TRUE()) returning TRUE
as a bug. The concern is the change in ISLOGICAL's result after naming the
value with LET. If this behavior is intentional, please clarify the intended
semantics.

Tested versions:
- LibreOffice 26.8.1.1, desktop: =LET(a,TRUE(),ISLOGICAL(a)) displays 0.
  [Paste the full Help > About LibreOffice information for this installation
here.]
- LibreOffice 26.2.6.3, Ubuntu package, Build ID: 620(Build:3): the LET
examples above were reproduced in a new document using UNO setFormula and
recalculation.
- LibreOffice 27.2.0.0.alpha0, Linux, Build ID:
b968188aca291c99a34722e46b69bff6b35ad977: the LET and LAMBDA examples above
were reproduced in a new document using UNO setFormula and recalculation.

The first affected version has not been identified; I am not claiming this is a
recent regression.

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

Reply via email to