[NumPy-Tickets] [NumPy] #1500: isfinite, isinf macros raise invalid value fp error flag

NumPy Trac numpy-tickets@scipy....
Thu Jun 3 12:10:08 CDT 2010

#1500: isfinite, isinf macros raise invalid value fp error flag
 Reporter:  efiring  |       Owner:  somebody
     Type:  defect   |      Status:  new     
 Priority:  low      |   Milestone:  2.0.0   
Component:  Other    |     Version:          
 Keywords:           |  
 In npy_math.h, if NPY_HAVE_DECL_ISFINITE is not defined, the macro that is
 defined in place of a system-supplied macro works by generating a nan when
 given an inf, and then using isnan to detect that case.  This raises the
 invalid value fp error flag, so every time numpy.isfinite encounters an
 inf, a warning is printed by default.  The situation is the same with
 isinf.  Here is the relevant code from npy_math.h:

     #define npy_isfinite(x) !npy_isnan((x) + (-x))
     #define npy_isfinite(x) isfinite((x))

     #define npy_isinf(x) (!npy_isfinite(x) && !npy_isnan(x))
     #define npy_isinf(x) isinf((x))

 The problem became evident because of a bug in setup.py: the
 NPY_HAVE_DECL_ macros were not being generated.  This was fixed in svn
 8455, so now the problem will appear only on those (very rare?) platforms
 that do not have their own isinf and isfinite.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1500>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list