Fix NullPointerException in BisectionSolver.solve(f, min, max, initial)

JIRA: MATH-369

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@940565 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Luc Maisonobe 2010-05-03 18:42:27 +00:00
parent 58f8b21d35
commit f4a4464bee
3 changed files with 10 additions and 1 deletions

View File

@ -69,7 +69,7 @@ public class BisectionSolver extends UnivariateRealSolverImpl {
/** {@inheritDoc} */
public double solve(final UnivariateRealFunction f, double min, double max, double initial)
throws MaxIterationsExceededException, FunctionEvaluationException {
return solve(min, max);
return solve(f, min, max);
}
/** {@inheritDoc} */

View File

@ -52,6 +52,9 @@ The <action> type attribute can be add,update,fix,remove.
If the output is not quite correct, check for invisible trailing spaces!
-->
<release version="2.2" date="TBD" description="TBD">
<action dev="luc" type="fix" issue="MATH-369" due-to="Sasun Pundev">
Fix NullPointerException in BisectionSolver.solve(f, min, max, initial)
</action>
</release>
<release version="2.1" date="2010-04-02" description="
This is primarily a maintenance release, but it also includes new features and enhancements.

View File

@ -95,6 +95,12 @@ public final class BisectionSolverTest extends TestCase {
assertTrue(solver.getIterationCount() > 0);
}
public void testMath369() throws Exception {
UnivariateRealFunction f = new SinFunction();
UnivariateRealSolver solver = new BisectionSolver();
assertEquals(Math.PI, solver.solve(f, 3.0, 3.2, 3.1), solver.getAbsoluteAccuracy());
}
/**
*
*/