You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Phil Steitz (JIRA)" <ji...@apache.org> on 2009/01/19 20:43:59 UTC
[jira] Resolved: (MATH-240) MathUtils.factorial(n) fails for n >=
17
[ https://issues.apache.org/jira/browse/MATH-240?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Phil Steitz resolved MATH-240.
------------------------------
Resolution: Fixed
Thanks for reporting this. Fixed in r735781.
> MathUtils.factorial(n) fails for n >= 17
> ----------------------------------------
>
> Key: MATH-240
> URL: https://issues.apache.org/jira/browse/MATH-240
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 2.0
> Reporter: Christian Semrau
> Assignee: Phil Steitz
> Priority: Minor
> Fix For: 2.0
>
>
> The result of MathUtils.factorial( n ) for n = 17, 18, 19 is wrong, probably because of rounding errors in the double calculations.
> Replace the first line of MathUtilsTest.testFactorial() by
> for (int i = 1; i <= 20; i++) {
> to check all valid arguments for the long result and see the failure.
> I suggest implementing a simple loop to multiply the long result - or even using a precomputed long[] - instead of adding logarithms.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.