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 loewis, mark.dickinson, ned.deily, trent
Date 2012-08-18.09:17:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345281434.64.0.213696665511.issue15477@psf.upfronthosting.co.za>
In-reply-to
Content
Trent, many thanks for the report and analysis.  The LOG1P_DROPS_ZERO_SIGN hackery was a result of a previous attempt to 'fix' the tests on another platform whose log1p didn't preserve zero signs.  But now that this behaviour has emerged on OS X too, I think it might be time to fix this in the Python core code (i.e., add a workaround for the buggy OS behaviour) instead of trying to make the tests pass again.

Attached is a patch that adds a workaround for this on all platforms that have a system log1p.  I was originally thinking of adding this workaround only on OS X (so as not to unnecessarily punish those platforms that get it right), but after running some timings (see below) it seems that the workaround is insignificant performance-wise, so we might as well keep things simple and add it on all platforms.

Trent, if you have time, please could you try this patch on OS X 10.8 and see if it fixes all the test_cmath and test_math failures?




Some timings on OS X 10.6.

Current default branch (pass value directly onto system log1p):

iwasawa:cpython mdickinson$ ./python.exe -m timeit -s 'from math import log1p; x = 2.3' 'log1p(x)'
10000000 loops, best of 3: 0.0685 usec per loop

With the attached patch (do zero check, then pass value directly onto system log1p):

iwasawa:cpython mdickinson$ ./python.exe -m timeit -s 'from math import log1p; x = 2.3' 'log1p(x)'
10000000 loops, best of 3: 0.0686 usec per loop
History
Date User Action Args
2012-08-18 09:17:14mark.dickinsonsetrecipients: + mark.dickinson, loewis, ned.deily, trent
2012-08-18 09:17:14mark.dickinsonsetmessageid: <1345281434.64.0.213696665511.issue15477@psf.upfronthosting.co.za>
2012-08-18 09:17:14mark.dickinsonlinkissue15477 messages
2012-08-18 09:17:13mark.dickinsoncreate