Re: [Numpy-discussion] Suggested change for NaN, Infs float->int conversion

2009-01-25 Thread josef . pktd
On Sun, Jan 25, 2009 at 4:35 AM, Matthew Brett wrote: > Hi, > > When converting arrays from float to ints, I notice that NaNs, Infs, > and -Infs all get the minimum integer value: > flts = np.array([np.nan, np.inf, -np.inf]) flts.astype(np.int16) > array([-32768, -32768, -32768], dtype=i

Re: [Numpy-discussion] Suggested change for NaN, Infs float->int conversion

2009-01-25 Thread Stéfan van der Walt
2009/1/25 Matthew Brett : > When converting arrays from float to ints, I notice that NaNs, Infs, > and -Infs all get the minimum integer value: > flts = np.array([np.nan, np.inf, -np.inf]) flts.astype(np.int16) > array([-32768, -32768, -32768], dtype=int16) > > However, setting NaNs into

[Numpy-discussion] Suggested change for NaN, Infs float->int conversion

2009-01-25 Thread Matthew Brett
Hi, When converting arrays from float to ints, I notice that NaNs, Infs, and -Infs all get the minimum integer value: >>> flts = np.array([np.nan, np.inf, -np.inf]) >>> flts.astype(np.int16) array([-32768, -32768, -32768], dtype=int16) However, setting NaNs into integer arrays gives a value of 0