| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#ifndef Py_FLOATOBJECT_H |
| 5 |
#define Py_FLOATOBJECT_H |
| 6 |
|
| 7 |
#ifdef _MSC_VER |
| 8 |
#include <math.h> |
| 9 |
#include <float.h> |
| 10 |
#endif |
| 11 |
|
| 12 |
#ifdef __cplusplus |
| 13 |
extern "C" { |
| 14 |
#endif |
| 15 |
|
| 16 |
typedef struct { |
| 17 |
PyObject_HEAD |
| 18 |
double ob_fval; |
| 19 |
} PyFloatObject; |
| 20 |
|
| 21 |
#define PyFloat_STR_PRECISION 12 |
| 22 |
|
| 23 |
#ifdef Py_NAN |
| 24 |
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) |
| 25 |
#endif |
| 26 |
|
| 27 |
#define Py_RETURN_INF(sign) do \ |
| 28 |
if (copysign(1., sign) == 1.) { \ |
| 29 |
return PyFloat_FromDouble(Py_HUGE_VAL); \ |
| 30 |
} else { \ |
| 31 |
return PyFloat_FromDouble(-Py_HUGE_VAL); \ |
| 32 |
} while(0) |
| 33 |
|
| 34 |
PyAPI_FUNC(int) PyFloat_Pack2(double x, char *p, int le); |
| 35 |
PyAPI_FUNC(int) PyFloat_Pack4(double x, char *p, int le); |
| 36 |
PyAPI_FUNC(int) PyFloat_Pack8(double x, char *p, int le); |
| 37 |
|
| 38 |
PyAPI_FUNC(double) PyFloat_Unpack2(const char *p, int le); |
| 39 |
PyAPI_FUNC(double) PyFloat_Unpack4(const char *p, int le); |
| 40 |
PyAPI_FUNC(double) PyFloat_Unpack8(const char *p, int le); |
| 41 |
PyAPI_FUNC(void) _PyFloat_InitState(void); |
| 42 |
|
| 43 |
#ifdef __cplusplus |
| 44 |
} |
| 45 |
#endif |
| 46 |
#endif |