From a27a4ba30f6f86a1278d3c65dd35478d2bac33bb Mon Sep 17 00:00:00 2001 From: Vyron Vasileiadis Date: Tue, 8 Sep 2026 00:20:09 +0300 Subject: [PATCH] gh-157135: Fix documentation errors in the half-turn `*pi` functions atanpi's docstring gave acospi's result range, the trigonometric summary table described atan2pi with atan's formula, and the comments above m_atanpi and m_atan2pi both read asin(x)/pi. --- Doc/library/math.rst | 2 +- Modules/mathmodule.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/math.rst b/Doc/library/math.rst index efe411e5a43f27d..70e61bb92fa7286 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -90,7 +90,7 @@ noted otherwise, all return values are floats. :func:`atan(x) ` Arc tangent of *x*, in radians :func:`atanpi(x) ` Arc tangent of *x*, in half-turns :func:`atan2(y, x) ` ``atan(y / x)``, in radians -:func:`atan2pi(y, x) ` ``atan(y / x)``, in half-turns +:func:`atan2pi(y, x) ` ``atanpi(y / x)``, in half-turns :func:`cos(x) ` Cosine of *x* radians :func:`cospi(x) ` Cosine of *x⋅π* radians :func:`sin(x) ` Sine of *x* radians diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index eaa1850b8aee1ac..7988a77ab0abcca 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -256,7 +256,7 @@ m_asinpi(double x) #ifndef HAVE_ATANPI /* - asin(x)/pi. It conforms to C23 Annex 'F'. + atan(x)/pi. It conforms to C23 Annex 'F'. */ static double @@ -274,7 +274,7 @@ m_atanpi(double x) #ifndef HAVE_ATAN2PI /* - asin(x)/pi. It conforms to C23 Annex 'F'. + atan2(y, x)/pi. It conforms to C23 Annex 'F'. */ static double @@ -1136,7 +1136,7 @@ FUNC1D(atanh, atanh, 0, FUNC1D(atanpi, m_atanpi, 0, "atanpi($module, x, /)\n--\n\n" "Return the arc tangent (measured in half-turns) of x.\n\n" - "The result is between 0 and 1.", + "The result is between -1/2 and 1/2.", "expected a number in range from -1 up to 1, got %s") FUNC1(cbrt, cbrt, 0, "cbrt($module, x, /)\n--\n\n"