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 vstinner
Recipients jcea, mark.dickinson, rhettinger, vstinner
Date 2011-04-25.23:39:40
SpamBayes Score 3.819486e-08
Marked as misclassified No
Message-id <>
> The main issue is that we'd have to provide (and maintain) our own
> implementation of log2 for Windows (and other OSs that don't have all
> the C99 support.  Solaris?)

Can't we simply use (approximation to 1/log(2)) * log(x)? Is it worse than reimplementing it using log(x)/log(2) in Python?

> That implementation should, ideally: ...

Because some platforms are less accurate, you prefer to not provide a more accurate function when log2() is available? Can't we start with something simple and improve it later?

It can be documented than the Python log2 function may be the same than log(x)/log(2) if the platform/CPU doesn't provide a C log2 function.


"... And indeed, on Windows ...

>>> numpy.log2(8.0)

Oh. Python is better on Linux:

Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.log(8) / math.log(2)
Date User Action Args
2011-04-25 23:39:42vstinnersetrecipients: + vstinner, rhettinger, jcea, mark.dickinson
2011-04-25 23:39:42vstinnersetmessageid: <>
2011-04-25 23:39:40vstinnerlinkissue11888 messages
2011-04-25 23:39:40vstinnercreate