final double baseRoot = forward ?
solver.solve(maxIterationCount, f, ta, tb) :
solver.solve(maxIterationCount, f, tb, ta);
final int remainingEval = maxIterationCount - solver.getEvaluations();
BracketedUnivariateSolver<UnivariateFunction> bracketing =
new PegasusSolver(solver.getRelativeAccuracy(), solver.getAbsoluteAccuracy());
root = forward ?
UnivariateSolverUtils.forceSide(remainingEval, f, bracketing,
baseRoot, ta, tb, AllowedSolution.RIGHT_SIDE) :
UnivariateSolverUtils.forceSide(remainingEval, f, bracketing,
baseRoot, tb, ta, AllowedSolution.LEFT_SIDE);