| 1 |
#ifndef Py_CPYTHON_FLOATOBJECT_H |
| 2 |
# error "this header file must not be included directly" |
| 3 |
#endif |
| 4 |
|
| 5 |
typedef struct { |
| 6 |
PyObject_HEAD |
| 7 |
double ob_fval; |
| 8 |
} PyFloatObject; |
| 9 |
|
| 10 |
#define _PyFloat_CAST(op) \ |
| 11 |
(assert(PyFloat_Check(op)), _Py_CAST(PyFloatObject*, op)) |
| 12 |
|
| 13 |
// Static inline version of PyFloat_AsDouble() trading safety for speed. |
| 14 |
// It doesn't check if op is a double object. |
| 15 |
static inline double PyFloat_AS_DOUBLE(PyObject *op) { |
| 16 |
return _PyFloat_CAST(op)->ob_fval; |
| 17 |
} |
| 18 |
#define PyFloat_AS_DOUBLE(op) PyFloat_AS_DOUBLE(_PyObject_CAST(op)) |
| 19 |
|
| 20 |
|
| 21 |
PyAPI_FUNC(int) PyFloat_Pack2(double x, char *p, int le); |
| 22 |
PyAPI_FUNC(int) PyFloat_Pack4(double x, char *p, int le); |
| 23 |
PyAPI_FUNC(int) PyFloat_Pack8(double x, char *p, int le); |
| 24 |
|
| 25 |
PyAPI_FUNC(double) PyFloat_Unpack2(const char *p, int le); |
| 26 |
PyAPI_FUNC(double) PyFloat_Unpack4(const char *p, int le); |
| 27 |
PyAPI_FUNC(double) PyFloat_Unpack8(const char *p, int le); |