Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/python3.12/internal/pycore_dtoa.h
1 #ifndef Py_INTERNAL_DTOA_H 2 #define Py_INTERNAL_DTOA_H 3 #ifdef __cplusplus 4 extern "C" { 5 #endif 6 7 #ifndef Py_BUILD_CORE 8 # error "this header requires Py_BUILD_CORE define" 9 #endif 10 11 #include "pycore_pymath.h" // _PY_SHORT_FLOAT_REPR 12 13 14 typedef uint32_t ULong; 15 16 struct 17 Bigint { 18 struct Bigint *next; 19 int k, maxwds, sign, wds; 20 ULong x[1]; 21 }; 22 23 #if defined(Py_USING_MEMORY_DEBUGGER) || _PY_SHORT_FLOAT_REPR == 0 24 25 struct _dtoa_state { 26 int _not_used; 27 }; 28 #define _dtoa_state_INIT(INTERP) \ 29 {0} 30 31 #else // !Py_USING_MEMORY_DEBUGGER && _PY_SHORT_FLOAT_REPR != 0 32 33 /* The size of the Bigint freelist */ 34 #define Bigint_Kmax 7 35 36 #ifndef PRIVATE_MEM 37 #define PRIVATE_MEM 2304 38 #endif 39 #define Bigint_PREALLOC_SIZE \ 40 ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double)) 41 42 struct _dtoa_state { 43 /* p5s is a linked list of powers of 5 of the form 5**(2**i), i >= 2 */ 44 // XXX This should be freed during runtime fini. 45 struct Bigint *p5s; 46 struct Bigint *freelist[Bigint_Kmax+1]; 47 double preallocated[Bigint_PREALLOC_SIZE]; 48 double *preallocated_next; 49 }; 50 #define _dtoa_state_INIT(INTERP) \ 51 { \ 52 .preallocated_next = (INTERP)->dtoa.preallocated, \ 53 } 54 55 #endif // !Py_USING_MEMORY_DEBUGGER 56 57 58 /* These functions are used by modules compiled as C extension like math: 59 they must be exported. */ 60 61 PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); 62 PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, 63 int *decpt, int *sign, char **rve); 64 PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); 65 66 #ifdef __cplusplus 67 } 68 #endif 69 #endif /* !Py_INTERNAL_DTOA_H */