From 10feab4ae1ff686c8eb9e902edb236236038baf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20Thom=C3=A9e?= <corentin.thomee@student.uliege.be> Date: Wed, 13 Mar 2024 14:25:04 +0100 Subject: [PATCH] Fixed the Kutta degenerate case --- hspm/src/solver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hspm/src/solver.cpp b/hspm/src/solver.cpp index 8972040..3cadd30 100644 --- a/hspm/src/solver.cpp +++ b/hspm/src/solver.cpp @@ -84,7 +84,7 @@ double HSPM::solveOffBodyKutta() { double _tau_terms = 2*(_a*_b + _c*_d - _e*_f - _g*_h); double _const_terms = pow(_b,2) + pow(_d,2) - pow(_f,2) - pow(_h,2); - if (_tau2_terms < 1e-10) + if (abs(_tau2_terms) < 1e-10) return -_const_terms / _tau_terms; // If the quadratic equation is degenerate, we can solve it directly // Solve the quadratic equation -- GitLab