Commit 6f1309c4 authored by Dorchies David's avatar Dorchies David
Browse files

Improving stop criteria of brent solver (related to #116 )

Showing with 7 additions and 1 deletion
+7 -1
...@@ -517,7 +517,13 @@ export class Dichotomie extends Debug { ...@@ -517,7 +517,13 @@ export class Dichotomie extends Debug {
tolAct = 1e-15 * Math.abs(b) + errorTol / 2; tolAct = 1e-15 * Math.abs(b) + errorTol / 2;
newStep = (c - b) / 2; newStep = (c - b) / 2;
if (Math.abs(newStep) <= tolAct && Math.abs(fb) < 0.1) { if (
Math.abs(newStep) <= tolAct
&& (
Math.abs(fb) < errorTol
|| Math.abs(fb / (Math.abs(fb) - Math.abs(fc))) < 1
)
) {
return b; // Acceptable approx. is found return b; // Acceptable approx. is found
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment