Bug 71123 - Other: inline arrays computing error
Summary: Other: inline arrays computing error
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.3.2 release
Hardware: Other Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-01 13:24 UTC by paul-k
Modified: 2014-07-21 10:20 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
File sample with differents formulas. (13.43 KB, application/vnd.oasis.opendocument.speadsheet)
2013-11-01 22:58 UTC, m_a_riosv
Details

Note You need to log in before you can comment on or make changes to this bug.
Description paul-k 2013-11-01 13:24:01 UTC
Arrays/Inline arrays computed differently when expected.

Steps to reproduce:
1. Enter 400638133393 into A1
2. Enter =SUM(MID(A1;{1;2;3;4;5;6;7;8;9;10;11;12};1)*{1;3;1;3;1;3;1;3;1;3;1;3})

Current behavior:
Result = 96

Expected behavior:
Result = 89

(Excel gives correct result)
Operating System: Windows 7
Version: 4.1.3.2 rc
Comment 1 m_a_riosv 2013-11-01 22:58:51 UTC
Created attachment 88520 [details]
File sample with differents formulas.

Hi Paul, thanks for reporting.

It is reproducible with:
Win7x64 Ultimate
Version: 3.5.7.2
Version: 4.0.6.2
Version: 4.1.4.0.0+Build ID: d6ee64b75581cbeb92534271ee6f4e87f07aa5c
AOO 4.0.1

MID() always return the first value "4", this is why result in 96.
Seems that MID() doesn't accept an inner array without an explicit array formula.

The follow formula get 89 as result:
{=SUM(VALUE(MID(A1;{1;2;3;4;5;6;7;8;9;10;11;12};1))*{1;3;1;3;1;3;1;3;1;3;1;3})}
entered as array Ctrl+Shift+Enter.
or
=SUMPRODUCT(VALUE(MID(A1;{1;2;3;4;5;6;7;8;9;10;11;12};1));{1;3;1;3;1;3;1;3;1;3;1;3})
but is needed to use VALUE() function transforming the string returned by MID() in a number.

So I can confirm the behaviour but I don't know if it is really a bug.
Comment 2 Joel Madero 2014-07-21 01:56:24 UTC
@Markus - can we get your thoughts on this bug, either NEW or NOTABUG?
Comment 3 Eike Rathke 2014-07-21 10:20:48 UTC
Not a bug. Functions taking a scalar argument as parameter have to be used in a matrix/array context to be evaluated for all elements of an array parameter. SUMPRODUCT is special in that it automatically forces all of its inner parameters into array context, SUM does not do that.