[Numpy-discussion] isinf raises in inf

Pauli Virtanen pav@iki...
Thu Jul 15 16:45:55 CDT 2010


Thu, 15 Jul 2010 09:54:12 -0500, John Hunter wrote:
[clip]
> In [4]: np.isinf(x)
> Warning: invalid value encountered in isinf Out[4]: True

As far as I know, isinf has always created NaNs -- since 2006 it has been 
defined on "unsupported" platforms as

	(!isnan((x)) && isnan((x)-(x)))

I'll replace it by the obvious

	((x) == NPY_INFINITY || (x) == -NPY_INFINITY)

which is true only for +-inf, and cannot raise any FPU exceptions.

-- 
Pauli Virtanen



More information about the NumPy-Discussion mailing list