2
0
mirror of https://github.com/boostorg/math.git synced 2026-02-02 21:02:20 +00:00

Fix heuristic in schroeder_iterate.

Brings schroeder_iterate more into line with halley_iterate.
This commit is contained in:
jzmaddock
2015-04-28 19:16:33 +01:00
parent 6277275f32
commit da33ba4425

View File

@@ -513,7 +513,8 @@ T schroeder_iterate(F f, T guess, T min, T max, int digits, boost::uintmax_t& ma
else
delta = ratio; // fall back to Newton iteration.
}
if(fabs(delta * 2) > fabs(delta2))
T convergence = fabs(delta / delta2);
if((convergence > 0.8) && (convergence < 2))
{
// last two steps haven't converged, try bisection:
delta = (delta > 0) ? (result - min) / 2 : (result - max) / 2;