Bug 107448 - Median operator returning first variable as result
Summary: Median operator returning first variable as result
Status: CLOSED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-04-26 13:05 UTC by Sathish
Modified: 2017-04-26 14:41 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 Sathish 2017-04-26 13:05:05 UTC
Description:
Incorrect result on using median operator in Libreoffice Calc

Steps to Reproduce:
1. The median operator in LibreOffice Calc while used with multiple randomly selected items, for example, is =MEDIAN(A74,A65,A55,A46,A38,A30).
2.  By mistake, if a user introduces a comma at the end of the list as =MEDIAN(A74,A65,A55,A46,A38,A30,), the function returns the first value in the list i.e. A74 as the result, which is wrong. Unsuspecting user might end up with wrong result.

Actual Results:  
=MEDIAN(A74,A65,A55,A46,A38,A30,) returns A74.

Expected Results:
=MEDIAN(A74,A65,A55,A46,A38,A30,) can return #VALUE indicating wrong syntax.


Reproducible: Always

User Profile Reset: No

Additional Info:


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Comment 1 Eike Rathke 2017-04-26 13:53:36 UTC
It's not the first argument that is returned. Appending a comma here passes another "missing" argument that when evaluated is taken as value 0 in the calculation.
=MEDIAN(1,2,4,8) => 3
=MEDIAN(1,2,4,8,) => 2
=MEDIAN(1,2,4,8,0) => 2
Excel does the same.
Comment 2 Sathish 2017-04-26 14:41:35 UTC
I am honestly sorry to raise the issue without prior understanding. I was looking for mean operator and assumed median does the job. Hence the confusion.