Subject: Increasing the accuracy of Gamma for double float
From: Raymond Toy
Date: Tue, 21 Oct 2008 15:31:49 -0400
Dieter Kaiser wrote:
> -----Urspr?ngliche Nachricht-----
> Von: raymond.toy at ericsson.com [mailto:raymond.toy at ericsson.com]
>
>>> I am not really surprised. It is no problem to get any desired precision. But
>>> calculating gamma we always need at least 3 to 5 extra digits. In double
> float
>>> precision we have no extra digits but lost the 3 to 5 digits we need to
>>> calculate gamma.
>
>> How did you arrive at this conclusion? Why does the computation require
>> 3 to 5 extra digits?
>
> This is not a really strong conclusion. I have played with two different sets of
> coefficients for gamma-lanczos which claimed to be accurate within 16 and 32
> digits, but I could only reproduce the results of the existing gamma-lanczos
> function.
I see. That makes sense.
FWIW, I played around with the dlngam function in slatec. For z from 10
to 150, dlngam differs from log_gamma by about 2.75d-16 (relative
error). Not too bad compared to double-float-epsilon of about 1.1d-16.
If we compare gamma(z) to exp(dlngam(z)), the max rel error is about
1.3d-13. Assuming gamma(z) with fpprec = 32 is correct, the error comes
from computing the exp. Not much we can do about that, I think.
Ray