From 0028c59d7ccd7c1b28950287c7b7b293338daabe Mon Sep 17 00:00:00 2001 From: jzmaddock Date: Sun, 16 Feb 2014 16:24:59 +0000 Subject: [PATCH] Fix for tgamma(x) where x < 0 and denorm. --- include/boost/math/special_functions/gamma.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)