8000 gh-135853: add `math.fmax` and `math.fmin` by picnixz · Pull Request #135888 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-135853: add math.fmax and math.fmin #135888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

picnixz
Copy link
Member
@picnixz picnixz commented Jun 24, 2025

I've added math.fmin and math.fmax as I think it'd be nice to have the NaN handling as per C99. I didn't make those functions generic or accept any iterable argument.

WDYT of this proposal @skirpichev @rhettinger?


📚 Documentation preview 📚: https://cpython-previews--135888.org.readthedocs.build/

@picnixz picnixz changed the title gh-135853: add math.fmax and math.fmin gh-135853: add math.fmax and math.fmin [PoC] Jun 24, 2025
@picnixz picnixz force-pushed the feat/math/fmin-fmax-135853 branch from 0831229 to afb0a91 Compare June 24, 2025 14:30
@picnixz picnixz changed the title gh-135853: add math.fmax and math.fmin [PoC] gh-135853: add math.fmax and math.fmin Jun 24, 2025
@picnixz picnixz marked this pull request as ready for review June 24, 2025 15:10
@picnixz picnixz requested a review from skirpichev June 24, 2025 15:10
@picnixz picnixz requested a review from rhettinger June 24, 2025 15:10
@picnixz picnixz requested a review from vstinner June 27, 2025 13:51
Copy link
Member
@vstinner vstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
@picnixz picnixz self-assigned this Jun 27, 2025
@@ -247,6 +249,30 @@ Floating point arithmetic
.. versionadded:: 3.13


.. function:: fmax(x, y, /)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. function:: fmax(x, y, /)
.. function:: fmax(x, y)

Lets not introduce this syntax, unless it's used in other functions of the module docs.

.. versionadded:: next


.. function:: fmin(x, y, /)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.. function:: fmin(x, y, /)
.. function:: fmin(x, y)

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.

3 participants
0