[Numpy-discussion] bug in oldnumeric.ma
Wed May 7 16:23:53 CDT 2008
2008/5/7 Pierre GM <firstname.lastname@example.org>:
> On Wednesday 07 May 2008 20:38:22 Anne Archibald wrote:
> > 2008/5/7 Pierre GM <email@example.com>:
> > > All,
> > > Yes, there is a problem with ma.power: masking negative data should be
> > > restricted to the case of an exponent between -1. and 1. only, don't you
> > > think ?
> > No, there's a problem with any fractional exponent (with even
> > denominator): x**(3/2) == (x**3)**(1/2).
> Argh. Good point.
> > The real
> > problem is "how do we predict when power() is going to produce a NaN?"
> An alternative would be to forget about it: let power() output NaNs, and fix
> them afterwards with fix_invalid.
Tempting, but the user may have used seterr() to arrange that
exceptions are raised when this happens, which is going to put a
spanner in the works.
(And temporarily changing seterr() is problematic in a multithreaded context...)
More information about the Numpy-discussion