From 9abdc80f15b71ac7ca87fd426668a3f5696c9b52 Mon Sep 17 00:00:00 2001 From: Jacob Hass Date: Tue, 13 Jan 2026 09:32:20 -0800 Subject: [PATCH] Changed asymptotic selection criteria to match previous implementations --- include/boost/math/special_functions/gamma.hpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/boost/math/special_functions/gamma.hpp b/include/boost/math/special_functions/gamma.hpp index 22a446a1e..267e58620 100644 --- a/include/boost/math/special_functions/gamma.hpp +++ b/include/boost/math/special_functions/gamma.hpp @@ -1827,9 +1827,8 @@ BOOST_MATH_GPU_ENABLED T lgamma_incomplete_lower_imp(T a, T x, const Policy& pol if(x < 0) return policies::raise_domain_error(function, "Argument x to the incomplete gamma function must be >= 0 (got x=%1%).", x, pol); - // This still needs work... - if (a > x + 50){ - std::cout << "Using approximation" << std::endl; + // Taken from conditions on Line 1354, 1368, 1709 + if (((a > 4 * x) && (a >= max_factorial::value)) || (T(-0.4) / log(x) < a) || ((x * 0.75f < a) && x < T(1.1))){ return log(detail::lower_gamma_series(a, x, pol)) - log(a) + a * log(x) - x - lgamma(a, pol); }