Bug 162439 - EXACT doesn't work with numbers in array context
Summary: EXACT doesn't work with numbers in array context
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.2.0.4 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL: https://ask.libreoffice.org/t/match-1...
Whiteboard: target:25.2.0 target:24.2.7 target:24...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2024-08-12 09:40 UTC by Mike Kaganski
Modified: 2024-08-30 13:35 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Formulas using EXACT (13.97 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-08-12 09:40 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2024-08-12 09:40:06 UTC
Created attachment 195805 [details]
Formulas using EXACT

1. In a new spreadsheet, put number '1' to A1, number '2' to A2.
2. In B1, put this formula: =EXACT(1, A1)
3. In C1, put this _array_ formula: {=EXACT(1, A1:A2)}

B1 shows TRUE, as expected.
C1 and C2 both show FALSE; the expected is TRUE in C1.

Regression after commit 7333881bb7b04f7e4e2a28638024ae82a9c14e81 (Formula tokens, formula cells and formula interpreters to use shared strings., 2013-10-11).

Ref.: https://ask.libreoffice.org/t/match-1-exact-not-working-with-numbers/71688
Comment 1 Mike Kaganski 2024-08-12 11:00:35 UTC
https://gerrit.libreoffice.org/c/core/+/171756
Comment 2 ady 2024-08-12 13:09:54 UTC
JIC, FWIW, quoting Eike:

<https://ask.libreoffice.org/t/match-1-exact-not-working-with-numbers/71688/16>

"EXACT() behaves like any other function that expects a single scalar argument when forced into array mode."

I am not sure about the real meaning of that quote. Can EXACT() be improved for the array argument case, still conforming to ODF standard?
Comment 3 Mike Kaganski 2024-08-12 13:25:40 UTC
(In reply to ady from comment #2)

The discussion on the Ask site suffered from the verbose textual descriptions, not accompanied by specific problematic cases. Cf. to steps in comment 0.

Hence, the assumptions made by Lupp there (that it's a bug in array evaluation, conversion, etc.) raised a question from Eike; but it never resulted in an actual, concise, comprehensible example. When I created one, it allowed to see the problem, debug it, and find out that the problem was just accidentally caused by array mode, and the true cause was incorrect assumption in comparison operation. Basically, EXACT is a normal scalar function, which may be used in array formulas just as well as any other scalar function, and nothing needs to change (in standard as well) to make that possible. This bug fix is not some fundamental change.
Comment 4 Commit Notification 2024-08-12 15:10:51 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/26931fa1ce1c22f0c54ab2916e9924b1c78f8efe

tdf#162439: compare strings, not pointers

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2024-08-19 21:01:19 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2":

https://git.libreoffice.org/core/commit/9b5cede6a6ac13215583d7b512f8ee393f8db968

tdf#162439: compare strings, not pointers

It will be available in 24.2.7.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2024-08-20 08:40:59 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/6298e5e418ea343d2b922ac2dd8147b1db5afe14

tdf#162439: compare strings, not pointers

It will be available in 24.8.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2024-08-30 13:35:47 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "libreoffice-24-2-6":

https://git.libreoffice.org/core/commit/9e443d67c6b294d493133fef1a9839ebf9dcb87c

tdf#162439: compare strings, not pointers

It will be available in 24.2.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.