Memory issue

Marc Glisse marc.glisse at
Fri Dec 24 11:28:20 CET 2010

On Thu, 23 Dec 2010, Craig Helfgott wrote:

> As it turns out, it was not a memory leak issue.  Instead, the issue was
> that my complex gamma function algorithm was a memory-hog when the imaginary
> part of the argument got large.  I'm still trying to figure out why.
> I'm not fond of Spouge's approximation -- too many sqrts and powers of e for
> me.  I had been using
> Gamma(z) ~= N^z e^{-N} / z \sum_{j=0}^{4N} N^j / (z+1)...(z+j) + E(N,z)
> for 1 <= Re(z) <= 2, with E(N,z) < 2^{-N}.  But this requires 10 times as
> many terms as Spouge's approximation (and like I said my implementation has
> some problems).
> Does anyone have a gamma approximation/algorithm that they prefer, and why?

mpfr uses Spouge, so it can't be that bad...

Specialists for this kind of computation are more likely to be found on 
the mpfr mailing-list.

Marc Glisse

More information about the gmp-discuss mailing list