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

Stuart Brorson sdb@cloud9....
Fri May 16 14:32:25 CDT 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