[Numpy-discussion] Proper NaN handling in max and co: a redux

David Cournapeau david@ar.media.kyoto-u.ac...
Fri Sep 26 12:20:28 CDT 2008


Anne Archibald wrote:
>
> I would think sign should return NaN (does it not now?) unless its
> return type is integer, in which case I can't see a better answer than
> raising an exception (we certainly don't want it silently swallowing
> NaNs).
>   

signbit (the C99 macro) returns an integer. So we have to check for nan
I think.

>
> Is it really a good idea to duplicate the maskedarray sorting code?
>   

This should be done in C (it is not difficult to do so, has a clear
speed advantage, and is the only solution for numpy arrays themselves)
and then, masked arrays can reuse this code.

cheers,

David


More information about the Numpy-discussion mailing list