File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // These definitions modified from numarray's Include/numarray/nummacro.h
2+
3+ #if defined(SIZEOF_VOID_P )
4+ #if SIZEOF_VOID_P == 8
5+ #define MPL_LP64 1
6+ #else
7+ #define MPL_LP64 0
8+ #endif
9+ #else
10+ #define MPL_LP64 0
11+ #endif
12+
13+ #if MPL_LP64
14+ typedef long int MPL_Int64 ;
15+ #else /* 32-bit platforms */
16+ #if defined(_MSC_VER )
17+ typedef __int64 MPL_Int64 ;
18+ #else
19+ typedef long long MPL_Int64 ;
20+ #endif
21+ #endif
22+
23+ #if !defined(MPL_isnan64 )
24+ #define MPL_U64 (u ) (* (MPL_Int64 *) &(u) )
25+
26+ #if !defined(_MSC_VER )
27+ #define MPL_isnan64 (u ) \
28+ ( (( MPL_U64(u) & 0x7ff0000000000000LL) == 0x7ff0000000000000LL) && ((MPL_U64(u) & 0x000fffffffffffffLL) != 0)) ? 1:0
29+ #else
30+ #define MPL_isnan64 (u ) \
31+ ( (( MPL_U64(u) & 0x7ff0000000000000i64) == 0x7ff0000000000000i64) && ((MPL_U64(u) & 0x000fffffffffffffi64) != 0)) ? 1:0
32+ #endif
33+ #endif /* MPL_isnan64 */
Original file line number Diff line number Diff line change 1+ #include "Python.h"
2+ #include "MPL_isnan.h"
3+
4+ static PyObject *
5+ isnan64 (PyObject * self , PyObject * args )
6+ {
7+ double input ;
8+ if (!PyArg_ParseTuple (args , "d" ,
9+ & input ))
10+ return NULL ;
11+
12+ if (MPL_isnan64 (input )) {
13+ Py_INCREF (Py_True );
14+ return Py_True ;
15+ }
16+
17+ Py_INCREF (Py_False );
18+ return Py_False ;
19+ }
20+
21+ static PyMethodDef _isnan_functions [] = {
22+ { "isnan64" , (PyCFunction )isnan64 , METH_VARARGS },
23+ { NULL , NULL , 0 }
24+ };
25+
26+ DL_EXPORT (void )
27+ init_isnan (void )
28+ {
29+ PyObject * mod ;
30+ mod = Py_InitModule ("matplotlib._isnan" ,
31+ _isnan_functions );
32+ }
You can’t perform that action at this time.
0 commit comments