GammaLowerRegularized and GammaUpperRegularized : bug for large first arg?

Jul 25, 2013 at 4:06 PM
Hello team,

I have come across some behaviour in GammaUpperRegularized which I find suspicious:

MathNet.Numerics.SpecialFunctions.GammaUpperRegularized(136.1375, 0.27)

gives 1.0

and

MathNet.Numerics.SpecialFunctions.GammaUpperRegularized(136.14, 0.27)

gives 0.0

I'd expect that GammaUpperRegularized be increasing wrt its first argument. If 136.14 is too large and causes some overflow, I'd nonetheless like the function to return 1.0 and not 0.0 .
  • Would you agree this is a bug?
  • I am using version
    System.Reflection.AssemblyFileVersionAttribute("2011.04.17"),
    has this been fixed in more recent versions?
Regards,
R
Coordinator
Jul 25, 2013 at 4:40 PM
Edited Jul 25, 2013 at 4:46 PM
Yes, there indeed seems to be a bug on very large a values, in L294 (and also L184). The algorithm does detect that the values are large enough for the result to be 1.0 (or 0.0) within the required precision, but then returns the wrong value. The threshold for the shortcut is hit on your second example, but not on the first one.

The current version v2.5 is affected as well.
Coordinator
Jul 26, 2013 at 1:12 PM
Fixed in mainline and thus made it into v2.6 which will be released quite soon. Thanks again for reporting.

Thanks,
Christoph
Marked as answer by cdrnet on 10/3/2013 at 3:32 PM