Mark Dickinson <dicki...@gmail.com> added the comment: Finally got around to looking at this properly.
Here's a first attempt at a patch to add gamma, lgamma, erf and erfc to the math module. It uses the pymath.c.diff code from nirinA, and adds docs, tests, and the extra infrastructure needed for the build system. The code has gone in a new file called Modules/math_cextra.c. The old approach of sticking things in pymath.c really isn't right, since that ends up putting the extra code into the core Python executable instead of the math module. There are currently many test failures; some of these are undoubtedly due to the tests being too strict, but some of them show problems with the code for these functions. It should be possible to have erf and erfc produce results accurate to within a few ulps (<50, say) over the entire extended real line; getting gamma and lgamma accurate for positive inputs should also be perfectly possible. Negative arguments seem to be more difficult to get right. To test the code on non-Windows, build with something like: CC='gcc -DTEST_GAMMA' ./configure && make the '-DTEST_GAMMA' just forces the build to use nirinA's code; without this, the math module will use the libm functions if they're available. This is just work-in-progress; apart from the test failures, there's still a lot of polishing to do before this can go in. The patch is against the trunk. ---------- versions: +Python 3.2 -Python 3.1 Added file: http://bugs.python.org/file14844/gamma.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue3366> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com