Dong-hee Na | 0a18ee4 | 2019-08-24 07:20:30 +0900 | [diff] [blame] | 1 | /*[clinic input] |
| 2 | preserve |
| 3 | [clinic start generated code]*/ |
| 4 | |
| 5 | PyDoc_STRVAR(_statistics__normal_dist_inv_cdf__doc__, |
| 6 | "_normal_dist_inv_cdf($module, p, mu, sigma, /)\n" |
| 7 | "--\n" |
| 8 | "\n"); |
| 9 | |
| 10 | #define _STATISTICS__NORMAL_DIST_INV_CDF_METHODDEF \ |
| 11 | {"_normal_dist_inv_cdf", (PyCFunction)(void(*)(void))_statistics__normal_dist_inv_cdf, METH_FASTCALL, _statistics__normal_dist_inv_cdf__doc__}, |
| 12 | |
| 13 | static double |
| 14 | _statistics__normal_dist_inv_cdf_impl(PyObject *module, double p, double mu, |
| 15 | double sigma); |
| 16 | |
| 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 | |
| 26 | if (!_PyArg_CheckPositional("_normal_dist_inv_cdf", nargs, 3, 3)) { |
| 27 | goto exit; |
| 28 | } |
Raymond Hettinger | aef9ad8 | 2019-08-24 19:10:39 -0700 | [diff] [blame] | 29 | if (PyFloat_CheckExact(args[0])) { |
| 30 | p = PyFloat_AS_DOUBLE(args[0]); |
Dong-hee Na | 0a18ee4 | 2019-08-24 07:20:30 +0900 | [diff] [blame] | 31 | } |
Raymond Hettinger | aef9ad8 | 2019-08-24 19:10:39 -0700 | [diff] [blame] | 32 | else |
| 33 | { |
| 34 | p = PyFloat_AsDouble(args[0]); |
| 35 | if (p == -1.0 && PyErr_Occurred()) { |
| 36 | goto exit; |
| 37 | } |
Dong-hee Na | 0a18ee4 | 2019-08-24 07:20:30 +0900 | [diff] [blame] | 38 | } |
Raymond Hettinger | aef9ad8 | 2019-08-24 19:10:39 -0700 | [diff] [blame] | 39 | if (PyFloat_CheckExact(args[1])) { |
| 40 | mu = PyFloat_AS_DOUBLE(args[1]); |
| 41 | } |
| 42 | else |
| 43 | { |
| 44 | mu = PyFloat_AsDouble(args[1]); |
| 45 | if (mu == -1.0 && PyErr_Occurred()) { |
| 46 | goto exit; |
| 47 | } |
| 48 | } |
| 49 | if (PyFloat_CheckExact(args[2])) { |
| 50 | sigma = PyFloat_AS_DOUBLE(args[2]); |
| 51 | } |
| 52 | else |
| 53 | { |
| 54 | sigma = PyFloat_AsDouble(args[2]); |
| 55 | if (sigma == -1.0 && PyErr_Occurred()) { |
| 56 | goto exit; |
| 57 | } |
Dong-hee Na | 0a18ee4 | 2019-08-24 07:20:30 +0900 | [diff] [blame] | 58 | } |
| 59 | _return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma); |
| 60 | if ((_return_value == -1.0) && PyErr_Occurred()) { |
| 61 | goto exit; |
| 62 | } |
| 63 | return_value = PyFloat_FromDouble(_return_value); |
| 64 | |
| 65 | exit: |
| 66 | return return_value; |
| 67 | } |
Raymond Hettinger | aef9ad8 | 2019-08-24 19:10:39 -0700 | [diff] [blame] | 68 | /*[clinic end generated code: output=c5826928a238326c input=a9049054013a1b77]*/ |