From cd0f0392bdcfafd1b9dcce4de08ffdd9a1a36ce1 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 22 Jan 2012 17:03:01 +0400 Subject: [PATCH] Fix bug in incompleteGamma Approximation for case s>1000 was calculated wrongly. --- Numeric/SpecFunctions.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Numeric/SpecFunctions.hs b/Numeric/SpecFunctions.hs index d4cfd23..8b2a148 100644 --- a/Numeric/SpecFunctions.hs +++ b/Numeric/SpecFunctions.hs @@ -178,7 +178,7 @@ incompleteGamma p x | otherwise = let g = p * log x - x - logGamma p + log cf in if g > limit then 1 - exp g else 1 where - norm a = erfc (- a / m_sqrt_2) + norm a = 0.5 * erfc (- a / m_sqrt_2) pearson !a !c !g | c' <= tolerance = g' | otherwise = pearson a' c' g'