Skip to content

Commit

Permalink
Merge pull request #59 from GComitini/integrate-early-exit
Browse files Browse the repository at this point in the history
Add Nan/infinite guard to gauss_kronrod_quadrature (early exit)
  • Loading branch information
Axect authored Apr 25, 2024
2 parents 690c2e9 + 169ab6d commit 6804677
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/numerical/integral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ where
tol
};
if (G - K).abs() < tol_curr || a == b || max_iter == 0 {
if ! G.is_finite() {
return G;
}
I += G;
} else {
S.push((a, c, tol / 2f64, max_iter - 1));
Expand Down

0 comments on commit 6804677

Please sign in to comment.