diff --git a/include/boost/math/special_functions/gamma.hpp b/include/boost/math/special_functions/gamma.hpp index f8a3e51bd..84f3ed7ee 100644 --- a/include/boost/math/special_functions/gamma.hpp +++ b/include/boost/math/special_functions/gamma.hpp @@ -245,7 +245,7 @@ T lgamma_imp(T z, const Policy& pol, const Lanczos& l, int* sign = 0) if (0 == z) return policies::raise_pole_error(function, "Evaluation of lgamma at %1%.", z, pol); if (fabs(z) < 1 / tools::max_value()) - result = -log(z); + result = -log(fabs(z)); else result = log(fabs(1 / z - constants::euler())); if (z < 0)