Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:06:49

0001 
0002 /* Float object interface */
0003 
0004 /*
0005 PyFloatObject represents a (double precision) floating-point number.
0006 */
0007 
0008 #ifndef Py_FLOATOBJECT_H
0009 #define Py_FLOATOBJECT_H
0010 #ifdef __cplusplus
0011 extern "C" {
0012 #endif
0013 
0014 PyAPI_DATA(PyTypeObject) PyFloat_Type;
0015 
0016 #define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
0017 #define PyFloat_CheckExact(op) Py_IS_TYPE((op), &PyFloat_Type)
0018 
0019 #define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
0020 
0021 #define Py_RETURN_INF(sign)                          \
0022     do {                                             \
0023         if (copysign(1., sign) == 1.) {              \
0024             return PyFloat_FromDouble(Py_HUGE_VAL);  \
0025         }                                            \
0026         else {                                       \
0027             return PyFloat_FromDouble(-Py_HUGE_VAL); \
0028         }                                            \
0029     } while(0)
0030 
0031 PyAPI_FUNC(double) PyFloat_GetMax(void);
0032 PyAPI_FUNC(double) PyFloat_GetMin(void);
0033 PyAPI_FUNC(PyObject*) PyFloat_GetInfo(void);
0034 
0035 /* Return Python float from string PyObject. */
0036 PyAPI_FUNC(PyObject*) PyFloat_FromString(PyObject*);
0037 
0038 /* Return Python float from C double. */
0039 PyAPI_FUNC(PyObject*) PyFloat_FromDouble(double);
0040 
0041 /* Extract C double from Python float.  The macro version trades safety for
0042    speed. */
0043 PyAPI_FUNC(double) PyFloat_AsDouble(PyObject*);
0044 
0045 #ifndef Py_LIMITED_API
0046 #  define Py_CPYTHON_FLOATOBJECT_H
0047 #  include "cpython/floatobject.h"
0048 #  undef Py_CPYTHON_FLOATOBJECT_H
0049 #endif
0050 
0051 #ifdef __cplusplus
0052 }
0053 #endif
0054 #endif /* !Py_FLOATOBJECT_H */