commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Phil Steitz (JIRA)" <j...@apache.org>
Subject [jira] Resolved: (MATH-240) MathUtils.factorial(n) fails for n >= 17
Date Mon, 19 Jan 2009 19:43:59 GMT

     [ 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.


Mime
View raw message