pystrtod.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef Py_STRTOD_H
  2. #define Py_STRTOD_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr);
  7. PyAPI_FUNC(double) PyOS_ascii_atof(const char *str);
  8. /* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */
  9. PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len,
  10. const char *format, double d);
  11. PyAPI_FUNC(double) PyOS_string_to_double(const char *str,
  12. char **endptr,
  13. PyObject *overflow_exception);
  14. /* The caller is responsible for calling PyMem_Free to free the buffer
  15. that's is returned. */
  16. PyAPI_FUNC(char *) PyOS_double_to_string(double val,
  17. char format_code,
  18. int precision,
  19. int flags,
  20. int *type);
  21. PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr);
  22. /* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */
  23. #define Py_DTSF_SIGN 0x01 /* always add the sign */
  24. #define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */
  25. #define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code
  26. specific */
  27. /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */
  28. #define Py_DTST_FINITE 0
  29. #define Py_DTST_INFINITE 1
  30. #define Py_DTST_NAN 2
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif /* !Py_STRTOD_H */