floatobject.h 900 B

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