File indexing completed on 2025-01-18 10:06:43
0001 #ifndef Py_INTERNAL_DTOA_H
0002 #define Py_INTERNAL_DTOA_H
0003 #ifdef __cplusplus
0004 extern "C" {
0005 #endif
0006
0007 #ifndef Py_BUILD_CORE
0008 # error "this header requires Py_BUILD_CORE define"
0009 #endif
0010
0011 #include "pycore_pymath.h" // _PY_SHORT_FLOAT_REPR
0012
0013
0014 typedef uint32_t ULong;
0015
0016 struct
0017 Bigint {
0018 struct Bigint *next;
0019 int k, maxwds, sign, wds;
0020 ULong x[1];
0021 };
0022
0023 #if defined(Py_USING_MEMORY_DEBUGGER) || _PY_SHORT_FLOAT_REPR == 0
0024
0025 struct _dtoa_state {
0026 int _not_used;
0027 };
0028 #define _dtoa_state_INIT(INTERP) \
0029 {0}
0030
0031 #else
0032
0033
0034 #define Bigint_Kmax 7
0035
0036 #ifndef PRIVATE_MEM
0037 #define PRIVATE_MEM 2304
0038 #endif
0039 #define Bigint_PREALLOC_SIZE \
0040 ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
0041
0042 struct _dtoa_state {
0043
0044
0045 struct Bigint *p5s;
0046 struct Bigint *freelist[Bigint_Kmax+1];
0047 double preallocated[Bigint_PREALLOC_SIZE];
0048 double *preallocated_next;
0049 };
0050 #define _dtoa_state_INIT(INTERP) \
0051 { \
0052 .preallocated_next = (INTERP)->dtoa.preallocated, \
0053 }
0054
0055 #endif
0056
0057
0058
0059
0060
0061 PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr);
0062 PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits,
0063 int *decpt, int *sign, char **rve);
0064 PyAPI_FUNC(void) _Py_dg_freedtoa(char *s);
0065
0066 #ifdef __cplusplus
0067 }
0068 #endif
0069 #endif