[Numpy-discussion] New ufuncs

Charles R Harris charlesr.harris@gmail....
Mon Nov 10 18:53:14 CST 2008


On Mon, Nov 10, 2008 at 5:15 PM, T J <tjhnson@gmail.com> wrote:

> On Mon, Nov 10, 2008 at 4:05 PM, Charles R Harris
> <charlesr.harris@gmail.com> 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
> returns
> > 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?
>
>
> http://projects.scipy.org/scipy/scipy/browser/trunk/scipy/special/cephes/exp2.c
> 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.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081110/89179d3b/attachment.html 


More information about the Numpy-discussion mailing list