commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gilles (JIRA)" <>
Subject [jira] [Created] (NUMBERS-46) ContinuedFraction: "maxIterations" argument
Date Mon, 03 Jul 2017 13:54:00 GMT
Gilles created NUMBERS-46:

             Summary: ContinuedFraction: "maxIterations" argument
                 Key: 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
public double evaluate(double x, double epsilon, int maxIterations)
cf.evaluate(x, eps, 1)
will raise an exception:
org.apache.commons.numbers.fraction.FractionException: maximal count (1) exceeded

At first sight, the check
if (n >= maxIterations) {
should rather be
if (n > maxIterations) {

However, it would also seem that the loop counter is wrong:
while (n < maxIterations) {
since setting {{maxIterations}} to 1 will in effect execute _zero_ iteration...

This message was sent by Atlassian JIRA

View raw message