summaryrefslogtreecommitdiff
path: root/Modules/mathmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2021-10-25 11:25:27 +0300
committerGitHub <noreply@github.com>2021-10-25 01:25:27 -0700
commitfa26245a1c1aa938cce391348d6bd879da357522 (patch)
treeb193ebf766f3105a880ce8d8f7160b090b0c77b2 /Modules/mathmodule.c
parent51ed2c56a1852cd6b09c85ba81312dc9782772ce (diff)
downloadcpython-git-fa26245a1c1aa938cce391348d6bd879da357522.tar.gz
bpo-45548: Remove _math.c workarounds for pre-C99 libm (GH-29179)
The :mod:`math` and :mod:`cmath` implementation now require a C99 compatible ``libm`` and no longer ship with workarounds for missing acosh, asinh, expm1, and log1p functions. The changeset also removes ``_math.c`` and moves the last remaining workaround into ``_math.h``. This simplifies static builds with ``Modules/Setup`` and resolves symbol conflicts. Co-authored-by: Mark Dickinson <mdickinson@enthought.com> Co-authored-by: Brett Cannon <brett@python.org> Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r--Modules/mathmodule.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
index 6c12a4e70d..67669f19bc 100644
--- a/Modules/mathmodule.c
+++ b/Modules/mathmodule.c
@@ -61,6 +61,9 @@ raised for division by zero and mod by zero.
#include "pycore_call.h" // _PyObject_CallNoArgs()
#include "pycore_dtoa.h" // _Py_dg_infinity()
#include "pycore_long.h" // _PyLong_GetZero()
+/* For DBL_EPSILON in _math.h */
+#include <float.h>
+/* For _Py_log1p with workarounds for buggy handling of zeros. */
#include "_math.h"
#include "clinic/mathmodule.c.h"
@@ -1166,14 +1169,14 @@ FUNC1(acos, acos, 0,
"acos($module, x, /)\n--\n\n"
"Return the arc cosine (measured in radians) of x.\n\n"
"The result is between 0 and pi.")
-FUNC1(acosh, m_acosh, 0,
+FUNC1(acosh, acosh, 0,
"acosh($module, x, /)\n--\n\n"
"Return the inverse hyperbolic cosine of x.")
FUNC1(asin, asin, 0,
"asin($module, x, /)\n--\n\n"
"Return the arc sine (measured in radians) of x.\n\n"
"The result is between -pi/2 and pi/2.")
-FUNC1(asinh, m_asinh, 0,
+FUNC1(asinh, asinh, 0,
"asinh($module, x, /)\n--\n\n"
"Return the inverse hyperbolic sine of x.")
FUNC1(atan, atan, 0,
@@ -1184,7 +1187,7 @@ FUNC2(atan2, m_atan2,
"atan2($module, y, x, /)\n--\n\n"
"Return the arc tangent (measured in radians) of y/x.\n\n"
"Unlike atan(y/x), the signs of both x and y are considered.")
-FUNC1(atanh, m_atanh, 0,
+FUNC1(atanh, atanh, 0,
"atanh($module, x, /)\n--\n\n"
"Return the inverse hyperbolic tangent of x.")
FUNC1(cbrt, cbrt, 0,
@@ -1245,7 +1248,7 @@ FUNC1A(erfc, m_erfc,
FUNC1(exp, exp, 1,
"exp($module, x, /)\n--\n\n"
"Return e raised to the power of x.")
-FUNC1(expm1, m_expm1, 1,
+FUNC1(expm1, expm1, 1,
"expm1($module, x, /)\n--\n\n"
"Return exp(x)-1.\n\n"
"This function avoids the loss of precision involved in the direct "