Implementation of the Logarithm of the Gamma function
Subject: Implementation of the Logarithm of the Gamma function
From: Dieter Kaiser
Date: Wed, 8 Oct 2008 21:51:59 +0200
Ray wrote:
> Note that using logs reduces the accuracy of the result, especially for
> large arguments that otherwise would have fit in a float.
> Don't know if this really matters or not.
Perhaps using the Logarithm of the Gamma function is only interesting for double
float values. Here we get an overflow for the Gamma function for values greater
than about 170.0. With the help of gamma_log we no longer have the problem of an
overflow.
I have done some tests to compare exp(gamma_log(z)) with gamma(z). We get an
increasing absolute error for the difference of the two result with increasing
z, but the relative error is almost constant and is within the expected error of
double float calculation.
Dieter Kaiser