From 169ab6d61ca7c8c28619aa18d534991d376796f9 Mon Sep 17 00:00:00 2001 From: Giorgio Comitini Date: Tue, 23 Apr 2024 12:52:53 +0200 Subject: [PATCH] IMPL: add Nan/infinite guard to gauss_kronrod_quadrature (early exit) --- src/numerical/integral.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/numerical/integral.rs b/src/numerical/integral.rs index ff9fdb20..ac2165dd 100644 --- a/src/numerical/integral.rs +++ b/src/numerical/integral.rs @@ -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));