Skip to content

Conversation

@SwayamInSync
Copy link
Member

Copilot Summary

This pull request adds support for the fmod (floating-point modulo) operation for quad-precision and long double types in the numpy quad dtype extension. It implements the correct mathematical behavior for fmod, including handling of edge cases, exposes the new ufunc to Python, documents the feature, and thoroughly tests it with a wide range of inputs and special properties.

Implementation of fmod operation:

  • Added quad_fmod and ld_fmod functions in ops.hpp to implement floating-point modulo for quad-precision and long double types, with correct handling of NaN, infinity, division by zero, sign preservation, and mathematical properties. [1] [2]

Integration and exposure in Python:

  • Registered the new fmod ufunc in init_quad_binary_ops so it is available as np.fmod for quad dtypes.

Documentation:

  • Updated release_tracker.md to mark fmod as implemented and tested for both quad and long double types.

Testing:

  • Added comprehensive tests for fmod in test_quaddtype.py, covering a wide range of edge cases (NaN, infinities, zeros, sign preservation, and mathematical identities), as well as differences from mod/remainder.

Copy link
Contributor

@juntyr juntyr left a comment

Choose a reason for hiding this comment

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

LGTM

@SwayamInSync
Copy link
Member Author

Merging this in!

@SwayamInSync SwayamInSync merged commit 4c2863d into numpy:main Oct 17, 2025
9 checks passed
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.

2 participants