[NumPy-Tickets] [NumPy] #2161: np.log gives RuntimeWarning for arrays with nan values when array is float32 but not float64

NumPy Trac numpy-tickets@scipy....
Fri Jun 15 10:42:01 CDT 2012


#2161: np.log gives RuntimeWarning for arrays with nan values when array is
float32 but not float64
------------------------+---------------------------------------------------
 Reporter:  cmorton     |       Owner:  somebody   
     Type:  defect      |      Status:  new        
 Priority:  low         |   Milestone:  Unscheduled
Component:  numpy.core  |     Version:  1.6.1      
 Keywords:              |  
------------------------+---------------------------------------------------
Changes (by cmorton):

 * cc: cmorton@… (added)
  * priority:  normal => low


Comment:

 I don't think my original code is totally correct, here is a simpler
 example:


 {{{
 >>> np.seterr(all='raise')
 >>> np.log(np.array([np.nan]).astype(np.float64))
 array([ nan])
 >>> np.log(np.array([np.nan]).astype(np.float32))
 Traceback (most recent call last):
   File "<pyshell#60>", line 1, in <module>
     np.log(np.array([np.nan]).astype(np.float32))
 FloatingPointError: invalid value encountered in log
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/2161#comment:1>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list