pystrtod.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef Py_STRTOD_H
  2. #define Py_STRTOD_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. PyAPI_FUNC(double) PyOS_string_to_double(const char *str,
  7. char **endptr,
  8. PyObject *overflow_exception);
  9. /* The caller is responsible for calling PyMem_Free to free the buffer
  10. that's is returned. */
  11. PyAPI_FUNC(char *) PyOS_double_to_string(double val,
  12. char format_code,
  13. int precision,
  14. int flags,
  15. int *type);
  16. #ifndef Py_LIMITED_API
  17. PyAPI_FUNC(PyObject *) _Py_string_to_number_with_underscores(
  18. const char *str, Py_ssize_t len, const char *what, PyObject *obj, void *arg,
  19. PyObject *(*innerfunc)(const char *, Py_ssize_t, void *));
  20. PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr);
  21. #endif
  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. #define Py_DTSF_NO_NEG_0 0x08 /* negative zero result is coerced to 0 */
  28. /* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */
  29. #define Py_DTST_FINITE 0
  30. #define Py_DTST_INFINITE 1
  31. #define Py_DTST_NAN 2
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif /* !Py_STRTOD_H */