Message92844
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. |
|
Date |
User |
Action |
Args |
2009-09-18 20:43:55 | mark.dickinson | set | recipients:
+ mark.dickinson, rhettinger, terry.reedy, stutzbach, nirinA |
2009-09-18 20:43:54 | mark.dickinson | set | messageid: <1253306634.98.0.629889201139.issue3366@psf.upfronthosting.co.za> |
2009-09-18 20:43:53 | mark.dickinson | link | issue3366 messages |
2009-09-18 20:43:53 | mark.dickinson | create | |
|