codekingpro/portable-devtools
115k
1 2/* Float object interface */3 4/*5PyFloatObject represents a (double precision) floating-point number.6*/7 8#ifndef Py_FLOATOBJECT_H9#define Py_FLOATOBJECT_H10#ifdef __cplusplus11extern "C" {12#endif13 14PyAPI_DATA(PyTypeObject) PyFloat_Type;15 16#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)17#define PyFloat_CheckExact(op) Py_IS_TYPE((op), &PyFloat_Type)18 19#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)20 21#define Py_RETURN_INF(sign) \22 do { \23 if (copysign(1., sign) == 1.) { \24 return PyFloat_FromDouble(Py_INFINITY); \25 } \26 else { \27 return PyFloat_FromDouble(-Py_INFINITY); \28 } \29 } while(0)30 31PyAPI_FUNC(double) PyFloat_GetMax(void);32PyAPI_FUNC(double) PyFloat_GetMin(void);33PyAPI_FUNC(PyObject*) PyFloat_GetInfo(void);34 35/* Return Python float from string PyObject. */36PyAPI_FUNC(PyObject*) PyFloat_FromString(PyObject*);37 38/* Return Python float from C double. */39PyAPI_FUNC(PyObject*) PyFloat_FromDouble(double);40 41/* Extract C double from Python float. The macro version trades safety for42 speed. */43PyAPI_FUNC(double) PyFloat_AsDouble(PyObject*);44 45#ifndef Py_LIMITED_API46# define Py_CPYTHON_FLOATOBJECT_H47# include "cpython/floatobject.h"48# undef Py_CPYTHON_FLOATOBJECT_H49#endif50 51#ifdef __cplusplus52}53#endif54#endif /* !Py_FLOATOBJECT_H */55 