Bug 167422 - AND function does not follow conventions
Summary: AND function does not follow conventions
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-08 12:09 UTC by rs
Modified: 2025-07-08 12:52 UTC (History)
0 users

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 rs 2025-07-08 12:09:59 UTC
Usually in a boolean statement with AND, arguments are tested from left to right until false is encountered. At the first false the end result is already decided, further arguments will not be tested and in that way automatically prevent errors. A number of users will expect this behavior and purposely would want to use AND this way: from left to right first test for the required values before you use them later in tests to the right. 

This post and my own experience prove that LO Calc is not implemented this way. I hereby recommend that this is fixed and that it will follow the conventions.

The issue is explained here https://ask.libreoffice.org/t/calc-and-function-bug-or-design-flaw/102235
Comment 1 Mike Kaganski 2025-07-08 12:52:09 UTC
The short-circuiting is not a "convention", it is an explicit decision made when designing features. Eager evaluation, as well as short-circuiting, both have their uses; e.g., users who create their user-defined functions, or use STYLE spreadsheet function, may depend on eager evaluation. This is not a bug. This is implemented as defined in the ODF standard. Also, this works the same way as in other spreadsheet applications: e.g., in MS Excel, a formula like `=AND(0, NA())` would produce #N/A, not FALSE.