Bug 125603 - combina(n,r) function should work even when r>n
Summary: combina(n,r) function should work even when r>n
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.2.4.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-31 06:47 UTC by Anantha Krishna K S
Modified: 2019-06-11 12:27 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Err. for combina(2,3) which should otherwise be 4. (129.20 KB, image/png)
2019-05-31 06:47 UTC, Anantha Krishna K S
Details
error for combina(n,r) when r>n (7.57 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-05-31 09:07 UTC, Anantha Krishna K S
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anantha Krishna K S 2019-05-31 06:47:16 UTC
Created attachment 151798 [details]
Err. for combina(2,3) which should otherwise be 4.

combina(n,r), i. e., combination with repetition should work even when r>n, For example combina(2,3)=4 because consider the combinations 000, 001, 011, 111 are the combinations of {0,1} i.e., two items (n=2) r=3 (here) with repetitions has four possibilities. General formula ((n,r))= (n+r-1, r) should work when both n and r are non zero.
Comment 1 m_a_riosv 2019-05-31 08:39:23 UTC
Please upload the sample file.
Comment 2 Anantha Krishna K S 2019-05-31 09:06:12 UTC
Comment on attachment 151798 [details]
Err. for combina(2,3) which should otherwise be 4.

I am attaching the file.
Comment 3 Anantha Krishna K S 2019-05-31 09:07:19 UTC
Created attachment 151802 [details]
error for combina(n,r) when r>n
Comment 4 Julien Nabet 2019-05-31 11:40:53 UTC
I'm not sure here since:
- https://help.libreoffice.org/6.3/en-US/text/scalc/01/04060106.html?DbPAR=CALC#bm_id3150284 (for LO)
- https://support.office.com/en-us/article/combina-function-efb49eaa-4f4c-4cd2-8179-0ddfcf9d035d?ui=en-US&rs=en-US&ad=US (for Excel)
indicate the first number must greater or equal to the second number.

Winfried: any thoughts here?
Comment 5 Jacques Guilleron 2019-06-01 17:30:07 UTC
Hi all,

As found by Julien in
- https://support.office.com/en-us/article/combina-function-efb49eaa-4f4c-4cd2-8179-0ddfcf9d035d?ui=en-US&rs=en-US&ad=US
The first number must be an integer greater than or equal to the second one.

Have a fine day,

Jacques.
Comment 6 Winfried Donkers 2019-06-11 11:43:48 UTC
(In reply to Julien Nabet from comment #4)
> I'm not sure here since:
> -
> https://help.libreoffice.org/6.3/en-US/text/scalc/01/04060106.
> html?DbPAR=CALC#bm_id3150284 (for LO)
> -
> https://support.office.com/en-us/article/combina-function-efb49eaa-4f4c-4cd2-
> 8179-0ddfcf9d035d?ui=en-US&rs=en-US&ad=US (for Excel)
> indicate the first number must greater or equal to the second number.
> 
> Winfried: any thoughts here?

COMBINA is a function defined in ODFF1.2:
http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#__RefHeading__1018494_715980110 ,
which uses o.a. the constraint that in COMBINA(N, M) N>=M.
So, COMBINA(2,3) should return an error, which it does.

So I close the bug report as the behaviour is compliant with the ODFF1.2 standard.

(I know that Excel returns 4 for COMBINA(2,3) _and_ that Excel's help states that the first argument must be greater than or equal to the second argument. Don't expect me to explain that.)
Comment 7 Julien Nabet 2019-06-11 12:27:29 UTC
Thank you Winfried for your feedback.
It's great to see we follow an open Standard instead of blindly following MS compatibility at any price even by reproducing their bugs!! :-)