[issue3366] Add gamma function, error functions and other C99 math.h functions to math module

Mark Dickinson report at bugs.python.org
Sat Jan 2 15:58:59 CET 2010


Mark Dickinson <dickinsm at gmail.com> added the comment:

> In Python, exp2(x) can be spelled 2.0**x.  What would exp2(x) gain us?

Not much, I suspect.  :)

I'd expect (but am mostly guessing) exp2(x) to have better accuracy than 
pow(2.0, x) for some math libraries;  I'd further guess that it's somewhat 
more likely to give exact results for (small) integral x.

Similarly for log2:  log2(n) should be a touch more accurate than 
log(n)/log(2), and the time you're most likely to notice the difference is 
when n is an exact power of 2.

But we've already got the 'bit_length' method for integers, which fills 
some of the potential uses for log2.  So unless there's a feeling that 
these functions are needed, I'd rather leave them out.

----------

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


More information about the Python-bugs-list mailing list