diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/clinic/mathmodule.c.h | 36 | ||||
-rw-r--r-- | Modules/mathmodule.c | 42 |
2 files changed, 1 insertions, 77 deletions
diff --git a/Modules/clinic/mathmodule.c.h b/Modules/clinic/mathmodule.c.h index 4e9fe20cf5..84a7a70cdc 100644 --- a/Modules/clinic/mathmodule.c.h +++ b/Modules/clinic/mathmodule.c.h @@ -80,40 +80,6 @@ PyDoc_STRVAR(math_factorial__doc__, #define MATH_FACTORIAL_METHODDEF \ {"factorial", (PyCFunction)math_factorial, METH_O, math_factorial__doc__}, -PyDoc_STRVAR(math_fma__doc__, -"fma($module, x, y, z, /)\n" -"--\n" -"\n" -"Fused multiply-add operation. Compute (x * y) + z with a single round."); - -#define MATH_FMA_METHODDEF \ - {"fma", (PyCFunction)math_fma, METH_FASTCALL, math_fma__doc__}, - -static PyObject * -math_fma_impl(PyObject *module, double x, double y, double z); - -static PyObject * -math_fma(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) -{ - PyObject *return_value = NULL; - double x; - double y; - double z; - - if (!_PyArg_ParseStack(args, nargs, "ddd:fma", - &x, &y, &z)) { - goto exit; - } - - if (!_PyArg_NoStackKeywords("fma", kwnames)) { - goto exit; - } - return_value = math_fma_impl(module, x, y, z); - -exit: - return return_value; -} - PyDoc_STRVAR(math_trunc__doc__, "trunc($module, x, /)\n" "--\n" @@ -570,4 +536,4 @@ math_isclose(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwna exit: return return_value; } -/*[clinic end generated code: output=f428e1075d00c334 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=71806f73a5c4bf0b input=a9049054013a1b77]*/ diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 66e88b69ce..8bd38d0eb8 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -1596,47 +1596,6 @@ math_factorial(PyObject *module, PyObject *arg) /*[clinic input] -math.fma - - x: double - y: double - z: double - / - -Fused multiply-add operation. Compute (x * y) + z with a single round. -[clinic start generated code]*/ - -static PyObject * -math_fma_impl(PyObject *module, double x, double y, double z) -/*[clinic end generated code: output=4fc8626dbc278d17 input=2ae8bb2a6e0f8b77]*/ -{ - double r; - r = fma(x, y, z); - - /* Fast path: if we got a finite result, we're done. */ - if (Py_IS_FINITE(r)) { - return PyFloat_FromDouble(r); - } - - /* Non-finite result. Raise an exception if appropriate, else return r. */ - if (Py_IS_NAN(r)) { - if (!Py_IS_NAN(x) && !Py_IS_NAN(y) && !Py_IS_NAN(z)) { - /* NaN result from non-NaN inputs. */ - PyErr_SetString(PyExc_ValueError, "invalid operation in fma"); - return NULL; - } - } - else if (Py_IS_FINITE(x) && Py_IS_FINITE(y) && Py_IS_FINITE(z)) { - /* Infinite result from finite inputs. */ - PyErr_SetString(PyExc_OverflowError, "overflow in fma"); - return NULL; - } - - return PyFloat_FromDouble(r); -} - - -/*[clinic input] math.trunc x: object @@ -2265,7 +2224,6 @@ static PyMethodDef math_methods[] = { {"fabs", math_fabs, METH_O, math_fabs_doc}, MATH_FACTORIAL_METHODDEF MATH_FLOOR_METHODDEF - MATH_FMA_METHODDEF MATH_FMOD_METHODDEF MATH_FREXP_METHODDEF MATH_FSUM_METHODDEF |