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-05.19:27:05
SpamBayes Score 3.5027536e-14
Marked as misclassified No
Message-id <1252178836.95.0.940019967294.issue3366@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-09-05 19:27:18mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, terry.reedy, stutzbach, nirinA
2009-09-05 19:27:16mark.dickinsonsetmessageid: <1252178836.95.0.940019967294.issue3366@psf.upfronthosting.co.za>
2009-09-05 19:27:15mark.dickinsonlinkissue3366 messages
2009-09-05 19:27:15mark.dickinsoncreate