commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (NUMBERS-46) ContinuedFraction: "maxIterations" argument
Date Sat, 27 Jan 2018 16:42:00 GMT

     [ https://issues.apache.org/jira/browse/NUMBERS-46?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Gilles resolved NUMBERS-46.
---------------------------
    Resolution: Fixed

> ContinuedFraction: "maxIterations" argument
> -------------------------------------------
>
>                 Key: NUMBERS-46
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-46
>             Project: Commons Numbers
>          Issue Type: Bug
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>             Fix For: 1.0
>
>
> In class {{o.a.c.numbers.fraction.ContinuedFraction}}, method {{evaluate}} is declared
as
> {code}
> public double evaluate(double x, double epsilon, int maxIterations)
> {code}
> Calling
> {code}
> cf.evaluate(x, eps, 1)
> {code}
> will raise an exception:
> {noformat}
> org.apache.commons.numbers.fraction.FractionException: maximal count (1) exceeded
> {noformat}
> At first sight, the check
> {code}
> if (n >= maxIterations) {
> {code}
> should rather be
> {code}
> if (n > maxIterations) {
> {code}
> However, it would also seem that the loop counter is wrong:
> {code}
> while (n < maxIterations) {
> {code}
> since setting {{maxIterations}} to 1 will in effect execute _zero_ iteration...



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message