[issue11888] Add C99's log2() function to the math library

STINNER Victor report at bugs.python.org
Mon May 9 14:10:13 CEST 2011


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

Issue #11888: Use system log2() when available
http://hg.python.org/cpython/rev/565f43f6bed4

"I expect the system libc to use more accurate functions than Python."

You know what? Mac OS X log2 is less accurate than Python log2! A log2 test failed on "x86 Tiger 3.x":

http://www.python.org/dev/buildbot/all/builders/x86%20Tiger%203.x/builds/2488
======================================================================
FAIL: testLog2 (test.test_math.MathTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_math.py", line 658, in testLog2
    self.assertEqual(actual, expected)
AssertionError: Lists differ: [-324.0, -323.0, -322.0, -321.... != [-324.0, -323.0, -322.0, -321....

First differing element 69:
-254.99999999999997
-255.0
----------------------------------------------------------------------

Should I revert my patch or should we test the system log2 in configure to check if it is as accurate or more accurate than Mark's algorithm?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11888>
_______________________________________


More information about the Python-bugs-list mailing list