for (int k = 0; (k < 4) && (ga * gb > 0); ++k) {
ta += epsilon;
try {
ga = f.value(ta);
} catch (FunctionEvaluationException ex) {
throw new DerivativeException(ex);
}
}
if (ga * gb > 0) {
// this should never happen
throw new MathInternalError();
}
}
final double root;
try {
root = (ta <= tb) ?
solver.solve(maxIterationCount, f, ta, tb) :
solver.solve(maxIterationCount, f, tb, ta);
} catch (FunctionEvaluationException ex) {
throw new DerivativeException(ex);
}
if ((!Double.isNaN(previousEventTime)) &&
(FastMath.abs(root - ta) <= convergence) &&
(FastMath.abs(root - previousEventTime) <= convergence)) {