Skip to content

Documentation errors in the new half-turn *pi functions #157135

Description

@fedonman

Bug description:

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.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions