Skip to content

Conversation

@SwayamInSync
Copy link
Member

Copilot Summary

This pull request adds full support for the modf function for the QuadPrecision dtype, including its implementation, integration with NumPy ufuncs, and comprehensive tests to ensure correct behavior. The changes cover both the backend C++ implementation and Python-level testing, and update the release tracker to reflect the new support.

Implementation of modf for QuadPrecision

  • Added new function signatures and implementations for unary operations with two outputs (modf and similar) in ops.hpp, including both Sleef_quad and long double backends. [1] [2]

NumPy Ufunc Integration

  • Implemented generic strided loops and descriptor resolution for unary ufuncs with two outputs, and registered the new modf ufunc for QuadPrecision in unary_ops.cpp. [1] [2]

Testing and Documentation

  • Added a thorough test suite for np.modf with QuadPrecision, checking a wide range of inputs and validating consistency with NumPy's float64 behavior.
  • Updated the release tracker to indicate that modf is now fully supported for QuadPrecision.

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, with two minor adjustments

# Numbers close to integers
"0.999999999999", "-0.999999999999", "1.000000000001", "-1.000000000001",
# Special values
"inf", "-inf", "nan",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also test -0.0 and +0.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

They are on the line 2468

@SwayamInSync
Copy link
Member Author

Cool lets merge it!

@SwayamInSync SwayamInSync merged commit e46eec9 into numpy:main Oct 22, 2025
10 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