1#ifndef Py_CPYTHON_FLOATOBJECT_H
2# error "this header file must not be included directly"
3#endif
4
5typedef 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.
15static 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
21PyAPI_FUNC(int) PyFloat_Pack2(double x, char *p, int le);
22PyAPI_FUNC(int) PyFloat_Pack4(double x, char *p, int le);
23PyAPI_FUNC(int) PyFloat_Pack8(double x, char *p, int le);
24
25PyAPI_FUNC(double) PyFloat_Unpack2(const char *p, int le);
26PyAPI_FUNC(double) PyFloat_Unpack4(const char *p, int le);
27PyAPI_FUNC(double) PyFloat_Unpack8(const char *p, int le);
28

source code of include/python3.12/cpython/floatobject.h