[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....
Thu Jun 14 19:10:56 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: normal | Milestone: Unscheduled
Component: numpy.core | Version: 1.6.1
Keywords: |
------------------------+---------------------------------------------------
I can easily suppress the warning by changing np.seterr, but it seemed
like there shouldn't be a different result between the two.
{{{
>>> import numpy as np
>>> np.seterr(all='raise')
>>> np.log(np.array([1, np.e, np.e**2, 0, np.nan]).astype(np.float64))
array([ 0., 1., 2., -inf])
>>>np.log(np.array([1, np.e, np.e**2, 0, np.nan]).astype(np.float32))
Traceback (most recent call last):
File "<pyshell#57>", line 1, in <module>
np.log(np.array([1, np.e, np.e**2, 0]).astype(np.float32))
FloatingPointError: divide by zero encountered in log
}}}
Sorry if this ticket is missing something, it is the first one I have ever
done.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/2161>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list