[Numpy-discussion] New ufuncs
Charles R Harris
Mon Nov 10 18:53:14 CST 2008
On Mon, Nov 10, 2008 at 5:15 PM, T J <email@example.com> wrote:
> On Mon, Nov 10, 2008 at 4:05 PM, Charles R Harris
> <firstname.lastname@example.org> wrote:
> > I added log2 and exp2. I still need to do the complex versions. I think
> > logaddexp2 should go in also to compliment these.
> Same here, especially since logaddexp is present. Or was the idea
> that both logexpadd and logexpadd2 should be moved to scipy.special?
> > Note that MPL also defines
> > log2 and their version has slightly different properties, i.e., it
> > integer values for integer powers of two.
> I'm just curious now. Can someone comment on the difference in the
> implementation just committed versus that in cephes?
> The difference won't matter to me as far as usage goes, but I was curious.
The version committed uses the distro exp2 if it is available, otherwise it
uses exp(log(2)*x). The committed version is also defined for floats and
long doubles, while the cephes version is double only. That said, the cephes
version uses a rational approximation and ldexp, so is probably faster than
exp(log(2)*x). The rational approximation is available for the other
precisions (Nash?), so we could use that if it was desireable. I think we
could also do better for log2 using frexp if needed. Probably the same with
logaddexp2. But that is for later polishing.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion