Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid underflow in invIncompleteGamma

Uderflow occurs in calculation of  inital approximation
if a*a = 0 then log(a*a) = -∞ and everything goes awry from this point
  • Loading branch information...
commit 1db1cff114a98f0a34abe8771427befca3f10ff5 1 parent 104816d
@Shimuuar Shimuuar authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  Numeric/SpecFunctions.hs
View
2  Numeric/SpecFunctions.hs
@@ -447,7 +447,7 @@ invIncompleteBetaWorker beta p q a = loop (0::Int) guess
| t'' <= 1 = exp( (log(a * p) + beta) / p )
| otherwise = 1 - 2 / (t'' + 1)
where
- r = sqrt ( - log ( a * a ) )
+ r = sqrt $ - 2 * log a
y = r - ( 2.30753 + 0.27061 * r )
/ ( 1.0 + ( 0.99229 + 0.04481 * r ) * r )
t = 1 / (9 * q)
Please sign in to comment.
Something went wrong with that request. Please try again.