This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients mark.dickinson, nirinA, rhettinger, stutzbach, terry.reedy
Date 2009-09-18.20:43:48
SpamBayes Score 3.9516435e-10
Marked as misclassified No
Message-id <1253306634.98.0.629889201139.issue3366@psf.upfronthosting.co.za>
In-reply-to
Content
Here's a more careful patch for just the gamma function.  It's a fairly 
direct implementation of Lanczos' formula, with the choice of parameters 
(N=13, g=6.024680040776729583740234375) taken from the Boost library.  In 
testing of random values and known difficult values, it's consistently 
giving errors of < 5ulps across its domain.  This is considerably better 
than the error from the exp(lgamma(x)) method, since the exp call alone 
can easily introduce errors of hundreds of ulps for larger values of x.

I'd appreciate any feedback, especially if anyone has the chance to test 
on Windows:  I'd like to know whether I got the build modifications right.

This patch *doesn't* use the system gamma function, even when available.  
At least on OS X 10.5.8, the supplied gamma function has pretty terrible 
accuracy, and some severe numerical problems near negative integers.  I 
don't imagine Linux is much better.

Once this is working, I'll concentrate on lgamma.  Then erf and erfc.
History
Date User Action Args
2009-09-18 20:43:55mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, terry.reedy, stutzbach, nirinA
2009-09-18 20:43:54mark.dickinsonsetmessageid: <1253306634.98.0.629889201139.issue3366@psf.upfronthosting.co.za>
2009-09-18 20:43:53mark.dickinsonlinkissue3366 messages
2009-09-18 20:43:53mark.dickinsoncreate