[Numpy-discussion] What is the sign of nan?

David Cournapeau david@ar.media.kyoto-u.ac...
Mon Sep 29 22:02:21 CDT 2008


Charles R Harris wrote:
>
> So the proposition is, sign, max, min return nan when any of the
> arguments is nan.

Note that internally, signbit (the C function) returns an integer.

>
> Complex numbers are more complicated because we first compare the real
> parts, then the imaginary. Arguably 1 > 0 + nan*1j.

Really ? Without thinking about the consequences, returning a NaN
complex would be what I expect, should we go the route comparison with
NaN returns a NaN.

> I propose that the sign of a complex number containing nans should be
> nan, but I can't decide what should happen with max/min

Did you take a look at:

http://projects.scipy.org/scipy/numpy/wiki/ProperNanHandling

Anne and me did this, with several approaches. We did not consider
interactions with the FPU error state, though, which is something which
needs to be added.

cheers,

David


More information about the Numpy-discussion mailing list