Skip to content

gh-150534: Add C23 math "*pi" functions#150555

Open
jepler wants to merge 6 commits into
python:mainfrom
jepler:c23-math-pifuns
Open

gh-150534: Add C23 math "*pi" functions#150555
jepler wants to merge 6 commits into
python:mainfrom
jepler:c23-math-pifuns

Conversation

@jepler
Copy link
Copy Markdown
Contributor

@jepler jepler commented May 28, 2026

See #150534 and https://discuss.python.org/t/add-half-turns-functions-cospi-et-al-to-math-module-following-c23-ieee754-2019/107550/5 for discussion and context.

The following functions are added to the math module:

  • acospi
  • asinpi
  • atanpi
  • atan2pi
  • cospi
  • sinpi
  • tanpi

The following aspects of a new feature are covered in this pull request:

  • Add tests
  • Add documentation
  • Add configure-time checks for function presence
  • Regenerate configure

The math_testcases.txt cases are based on glibc's test cases, and their input & output values have been used. I don't know whether these test cases will pass on other platforms, it depends on the quality of the platform trig functionality which is not previously tested so extensively. These cases may need to be revisited if they do not pass everywhere.

Closes: #150534

jepler added 4 commits May 27, 2026 12:41
 * Add tests
 * Add documentation
 * Add configure-time checks for function presence
 * Regenerate configure

No news item added, pending creation of a github issue.

As committed, the local implementation of the functions is always
used. For production, the #undefs should be removed so that the
presence of the functions is detected by configure and used by
mathmodule.
@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented May 28, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #32890538 | 📁 Comparing 86de1c0 against main (f386f1f)

  🔍 Preview build  

4 files changed
± library/lzma.html
± library/math.html
± whatsnew/3.16.html
± whatsnew/changelog.html

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'half turns' functions (cospi et al) to math module following C23 & IEEE754-2019

1 participant