24#ifndef quantlib_solver1d_newtonsafe_h
25#define quantlib_solver1d_newtonsafe_h
27#include <ql/math/solver1d.hpp>
44 Real xAccuracy)
const {
52 Real froot, dfroot, dx, dxold;
73 dfroot = f.derivative(
root_);
75 "NewtonSafe requires function's derivative");
80 if ((((
root_-xh)*dfroot-froot)*
81 ((
root_-xl)*dfroot-froot) > 0.0)
82 || (std::fabs(2.0*froot) > std::fabs(dxold*dfroot))) {
93 if (std::fabs(dx) < xAccuracy) {
99 dfroot = f.derivative(
root_);
107 QL_FAIL(
"maximum number of function evaluations ("
Real solveImpl(const F &f, Real xAccuracy) const
template class providing a null value for a given type.
Base class for 1-D solvers.