To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=47296





------- Additional comments from [EMAIL PROTECTED] Mon Sep  5 14:27:07 -0700 
2005 -------
The reason why the old algorithm failed is because of an overflow in
double-precision variable during a calculation of binomial coefficient (note
that a calculation of hypergeometric distribution involves calculations of three
binomial coefficients).

  binomial coefficient: (n, k) = n! / k!(n-k)!

In the old method, these three factorials n!, k! and (n-k)! were immediately
calculated, which caused an overflow.  In my proposed method, I expand these
factorials into individual elements e.g.

  10! -> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

and store them into an enumerator array or a denominator array (whichever is
appropriate).  These elements get accumulated in these two arrays during all
three binomial coefficient calculations.

Once that's done, the elements in these two arrays are sorted in descending
order (from largest to smallest), and divisions are performed on all stored
elements sequentially from the largest elements downward (see my proposed patch
for implementation details).

This probably is the safest way of calculation when the calculation involves
multiple factorial elements.  And I recommend the way I calculated the
hypergeometric distribution here be applied to other calculation methods that
may have a similar numerical overflow problem.

Kohei

---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to