[Libreoffice-bugs] [Bug 43135] MULTINOMIAL(1000, 0) returns Err:502, expected 1

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Fri Nov 25 11:33:42 PST 2011


https://bugs.freedesktop.org/show_bug.cgi?id=43135

--- Comment #5 from Bas Braams <readingthepapers at gmail.com> 2011-11-25 11:33:42 PST ---
The presumed cause of the bug is that the multinomial is computed as a ratio of
factorials; this would indeed cause an overflow when the sum of the arguments
exceeds 170. Please note that for the implementation of the Binomial in
LibreOffice Calc (function COMBIN) no such restriction applies; it is computed
carefully to avoid unnecessary overflow.

Please note also that the bug with multinomial would be almost trivial to fix.

A recurrence for computing the multinomial function as a product of
binomials may be found in the description of the multinomial function in
the Sage mathematics system:

http://www.sagemath.org/doc/reference/sage/rings/arith.html#sage.rings.arith.multinomial

The associated 5-line Python code by Gabriel Ebner may be found here:

http://trac.sagemath.org/sage_trac/attachment/ticket/3132/trac3132-2.diff

I believe that this is a very natural way to compute the multinomial, and it
would completely remove the problem of unnecessary overflow.

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Libreoffice-bugs mailing list