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-21.10:45:06
SpamBayes Score 2.324394e-09
Marked as misclassified No
Message-id <1253529924.6.0.455265710371.issue3366@psf.upfronthosting.co.za>
In-reply-to
Content
New patch for gamma , with some tweaks:

 - return exact values for integral arguments: gamma(1) through gamma(23)
 - apply a cheap correction to improve accuracy of exp and pow
   computations
 - use a different form of the reflection formula:

     gamma(x) = -pi/sinpi(x)/x/gamma(x)

   (the usual reflection formula has accuracy problems for
    x close to a power of 2;  e.g., x in (-64,-63) or x
    in (-128, -127))

 - avoid duplication formula for large negative arguments
 - add a few extra tests

On my machine, testing with approx. 10**7 random samples, this version 
achieves an accuracy of <= 10 ulps across the domain (comparing with 
correctly-rounded results generated by MPFR).  Limiting the test to 
arguments in the range (-256.0, 1/256.0] + [1/256.0, 256.0) (with each 
float in that range equally likely), the error in ulps from 10**6 samples 
has mean -0.104 and standard deviation 1.230.

I plan to check this in in a week or two.  Feedback welcome!  It would be 
especially useful to know whether this patch compiles correctly on 
Windows.
History
Date User Action Args
2009-09-21 10:45:25mark.dickinsonsetrecipients: + mark.dickinson, rhettinger, terry.reedy, stutzbach, nirinA
2009-09-21 10:45:24mark.dickinsonsetmessageid: <1253529924.6.0.455265710371.issue3366@psf.upfronthosting.co.za>
2009-09-21 10:45:23mark.dickinsonlinkissue3366 messages
2009-09-21 10:45:22mark.dickinsoncreate