Message168498
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 |
|
Date |
User |
Action |
Args |
2012-08-18 09:17:14 | mark.dickinson | set | recipients:
+ mark.dickinson, loewis, ned.deily, trent |
2012-08-18 09:17:14 | mark.dickinson | set | messageid: <1345281434.64.0.213696665511.issue15477@psf.upfronthosting.co.za> |
2012-08-18 09:17:14 | mark.dickinson | link | issue15477 messages |
2012-08-18 09:17:13 | mark.dickinson | create | |
|