_statisticsmodule.c.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*[clinic input]
  2. preserve
  3. [clinic start generated code]*/
  4. #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
  5. # include "pycore_gc.h" // PyGC_Head
  6. # include "pycore_runtime.h" // _Py_ID()
  7. #endif
  8. PyDoc_STRVAR(_statistics__normal_dist_inv_cdf__doc__,
  9. "_normal_dist_inv_cdf($module, p, mu, sigma, /)\n"
  10. "--\n"
  11. "\n");
  12. #define _STATISTICS__NORMAL_DIST_INV_CDF_METHODDEF \
  13. {"_normal_dist_inv_cdf", _PyCFunction_CAST(_statistics__normal_dist_inv_cdf), METH_FASTCALL, _statistics__normal_dist_inv_cdf__doc__},
  14. static double
  15. _statistics__normal_dist_inv_cdf_impl(PyObject *module, double p, double mu,
  16. double sigma);
  17. static PyObject *
  18. _statistics__normal_dist_inv_cdf(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
  19. {
  20. PyObject *return_value = NULL;
  21. double p;
  22. double mu;
  23. double sigma;
  24. double _return_value;
  25. if (!_PyArg_CheckPositional("_normal_dist_inv_cdf", nargs, 3, 3)) {
  26. goto exit;
  27. }
  28. if (PyFloat_CheckExact(args[0])) {
  29. p = PyFloat_AS_DOUBLE(args[0]);
  30. }
  31. else
  32. {
  33. p = PyFloat_AsDouble(args[0]);
  34. if (p == -1.0 && PyErr_Occurred()) {
  35. goto exit;
  36. }
  37. }
  38. if (PyFloat_CheckExact(args[1])) {
  39. mu = PyFloat_AS_DOUBLE(args[1]);
  40. }
  41. else
  42. {
  43. mu = PyFloat_AsDouble(args[1]);
  44. if (mu == -1.0 && PyErr_Occurred()) {
  45. goto exit;
  46. }
  47. }
  48. if (PyFloat_CheckExact(args[2])) {
  49. sigma = PyFloat_AS_DOUBLE(args[2]);
  50. }
  51. else
  52. {
  53. sigma = PyFloat_AsDouble(args[2]);
  54. if (sigma == -1.0 && PyErr_Occurred()) {
  55. goto exit;
  56. }
  57. }
  58. _return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma);
  59. if ((_return_value == -1.0) && PyErr_Occurred()) {
  60. goto exit;
  61. }
  62. return_value = PyFloat_FromDouble(_return_value);
  63. exit:
  64. return return_value;
  65. }
  66. /*[clinic end generated code: output=6899dc752cc6b457 input=a9049054013a1b77]*/