You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Four statements added with the half-turn functions in GH-150555 describe a different function than the one they document.
$ ./python -c 'import math; print(math.atanpi.__doc__); print(math.atanpi(-1), math.atan2pi(-1, -1), math.atanpi(-1 / -1))'
Return the arc tangent (measured in half-turns) of x.
The result is between 0 and 1.
-0.25 -0.75 0.25
atanpi's docstring in Modules/mathmodule.c says "The result is between 0 and 1". The range is -1/2 to 1/2, as Doc/library/math.rst states.
The trigonometric summary table in Doc/library/math.rst describes atan2pi(y, x) as "atan(y / x), in half-turns". atan returns radians, and the entry for the function itself says atanpi(y / x).
The comment above m_atanpi in Modules/mathmodule.c reads "asin(x)/pi". The function computes atan(x)/pi.
The comment above m_atan2pi in Modules/mathmodule.c reads "asin(x)/pi". The function computes atan2(y, x)/pi.
Bug description:
Four statements added with the half-turn functions in GH-150555 describe a different function than the one they document.
atanpi's docstring inModules/mathmodule.csays "The result is between 0 and 1". The range is -1/2 to 1/2, asDoc/library/math.rststates.Doc/library/math.rstdescribesatan2pi(y, x)as "atan(y / x), in half-turns".atanreturns radians, and the entry for the function itself saysatanpi(y / x).m_atanpiinModules/mathmodule.creads "asin(x)/pi". The function computesatan(x)/pi.m_atan2piinModules/mathmodule.creads "asin(x)/pi". The function computesatan2(y, x)/pi.CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
*pifunctions #157136