diff --git a/src/Numerics/RootFinding/Algorithms/Bisection.cs b/src/Numerics/RootFinding/Algorithms/Bisection.cs
index 71b109d2..5ad802d1 100644
--- a/src/Numerics/RootFinding/Algorithms/Bisection.cs
+++ b/src/Numerics/RootFinding/Algorithms/Bisection.cs
@@ -50,8 +50,14 @@ namespace MathNet.Numerics.RootFinding.Algorithms
double fmin = f(lowerBound);
double fmax = f(upperBound);
- if (fmin == 0.0) return lowerBound;
- if (fmax == 0.0) return upperBound;
+ if (Math.Abs(fmin) < accuracy)
+ {
+ return lowerBound;
+ }
+ if (Math.Abs(fmax) < accuracy)
+ {
+ return upperBound;
+ }
if (Math.Sign(fmin) == Math.Sign(fmax))
{
diff --git a/src/Numerics/RootFinding/Algorithms/HybridNewtonRaphson.cs b/src/Numerics/RootFinding/Algorithms/HybridNewtonRaphson.cs
index 11093b1a..0e05b4fe 100644
--- a/src/Numerics/RootFinding/Algorithms/HybridNewtonRaphson.cs
+++ b/src/Numerics/RootFinding/Algorithms/HybridNewtonRaphson.cs
@@ -39,8 +39,9 @@ namespace MathNet.Numerics.RootFinding.Algorithms
/// The first derivative of the function to find roots from.
/// The low value of the range where the root is supposed to be.
/// The high value of the range where the root is supposed to be.
- /// Desired accuracy. The root will be refined until the accuracy or the maximum number of iterations is reached.
- /// Maximum number of iterations.
+ /// Desired accuracy. The root will be refined until the accuracy or the maximum number of iterations is reached. Example: 1e-14.
+ /// Maximum number of iterations. Example: 100.
+ /// How many parts an interval should be split into for zero crossing scanning in case of lacking bracketing. Example: 20.
/// Returns the root with the specified accuracy.
/// Hybrid Newton-Raphson that falls back to bisection when overshooting or converging too slow, or to subdivision on lacking bracketing.
///
@@ -59,8 +60,9 @@ namespace MathNet.Numerics.RootFinding.Algorithms
/// The first derivative of the function to find roots from.
/// The low value of the range where the root is supposed to be.
/// The high value of the range where the root is supposed to be.
- /// Desired accuracy. The root will be refined until the accuracy or the maximum number of iterations is reached.
- /// Maximum number of iterations.
+ /// Desired accuracy. The root will be refined until the accuracy or the maximum number of iterations is reached. Example: 1e-14.
+ /// Maximum number of iterations. Example: 100.
+ /// How many parts an interval should be split into for zero crossing scanning in case of lacking bracketing. Example: 20.
/// The root that was found, if any. Undefined if the function returns false.
/// True if a root with the specified accuracy was found, else false.
/// Hybrid Newton-Raphson that falls back to bisection when overshooting or converging too slow, or to subdivision on lacking bracketing.
@@ -69,12 +71,12 @@ namespace MathNet.Numerics.RootFinding.Algorithms
double fmin = f(lowerBound);
double fmax = f(upperBound);
- if (fmin == 0.0)
+ if (Math.Abs(fmin) < accuracy)
{
root = lowerBound;
return true;
}
- if (fmax == 0.0)
+ if (Math.Abs(fmax) < accuracy)
{
root = upperBound;
return true;