[Numpy-discussion] numpy.sign(numpy.nan)?????

Stuart Brorson sdb at cloud9.net
Fri May 16 15:32:25 EDT 2008


Hi --

>> In [66]: numpy.sign(numpy.nan)
>> Out[66]: 0.0
>>
>> IMO, the output should be NaN, not zero.

> You're probably right. I would like to see what other systems do
> before changing it, though.

Here's what Matlab does:

>> A = nan

A =

    NaN

>> sign(A)

ans =

    NaN

>> B = [1, nan]

B =

      1   NaN

>> sign(B)

ans =

      1   NaN


Cheers,

Stuart Brorson 
Interactive Supercomputing, inc. 
135 Beaver Street | Waltham | MA | 02452 | USA 
http://www.interactivesupercomputing.com/




More information about the NumPy-Discussion mailing list