Message97133
| Author |
mark.dickinson |
| Recipients |
mark.dickinson, ned.deily, nirinA, rhettinger, steven.daprano, stutzbach, terry.reedy, tim.peters |
| Date |
2010年01月02日.14:58:56 |
| SpamBayes Score |
1.6987879e-06 |
| Marked as misclassified |
No |
| Message-id |
<1262444339.73.0.832266824422.issue3366@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
> 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. |
|