[Numpy-discussion] What is the sign of nan?
Charles R Harris
Mon Sep 29 20:22:41 CDT 2008
On Mon, Sep 29, 2008 at 4:28 PM, Robert Kern <firstname.lastname@example.org> wrote:
> On Mon, Sep 29, 2008 at 17:13, Charles R Harris
> <email@example.com> wrote:
> > On Mon, Sep 29, 2008 at 3:52 PM, Charles R Harris
> > <firstname.lastname@example.org> wrote:
> >> Hi All,
> >> I've been cleaning up the ufunc loops and the sign function currently
> >> doesn't have a defined behavior for nans. This makes the results depend
> >> the order/type of comparisons in the code, which looks fragile to me. So
> >> what should it return? I vote for nan but am open for suggestions.
> > And while we're at it, lets decide how to treat max/min when nans are
> > involved. Or should we just say the behavior is undefined.
> When feasible, I would like float(s)->float functions to return NaN
> when given a NaN as an argument. At least as the main versions of the
> function. Specific NaN-ignoring functions can also be introduced, but
> as separate functions. I don't know what exactly to do about
> float->int functions (e.g. argmin). I also don't know how these should
> interact with the current seterr() state.
OK, maximum, minimum, and sign now return NaN. I still don't know what to do
for the complex cases, although I suspect they should do the same on the
principal that if either the real or imaginary parts are NaN then the number
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Numpy-discussion