Skip to content

Conversation

@SwayamInSync
Copy link
Member

Copilot Summary

This pull request adds full support for the divmod operation to the quad-precision NumPy dtype (QuadPrecDType). It introduces the necessary backend implementations, generic ufunc registration, and comprehensive test coverage to ensure correctness and compatibility with NumPy's behavior, including edge cases and broadcasting. The release tracker is updated to reflect this new feature.

Backend and ufunc support

  • Added generic function signatures for binary quad and long double operations with two outputs, enabling support for operations like divmod, modf, and frexp in ops.hpp. [1] [2]
  • Implemented backend functions quad_divmod and ld_divmod for quad and long double types, respectively, to compute both quotient and remainder. [1] [2]
  • Added generic strided loop implementations and descriptor resolution for binary operations with two outputs, and registered the new divmod ufunc for quad-precision in binary_ops.cpp. [1] [2]

Documentation and release tracking

  • Updated release_tracker.md to mark high-endian system support as complete and added divmod to the list of supported ufuncs with edge case testing. [1] [2]

Testing

  • Added comprehensive tests for divmod covering scalar, array, broadcasting, and all edge cases, verifying correctness and NumPy compatibility.

@SwayamInSync
Copy link
Member Author

divmod's signature is different 2in and 2 out (similar to frexp) so we better have the template in general to utilize in other ufuncs

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 df10dd7 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