FEAT: spacing
ufunc implementation
#191
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Copilot Summary
This pull request adds support for the
spacing
function for the QuadPrecision dtype, aligning its behavior with NumPy conventions and providing comprehensive tests. The changes implement the core logic for spacing in both quad and long double precision, register the new ufunc with NumPy, update documentation, and introduce a thorough test suite to verify correctness for edge cases and typical values.QuadPrecision
spacing
function implementationquad_spacing
andld_spacing
functions to compute the spacing between a value and its next representable value, handling NaN and infinity per NumPy conventions and preserving the sign of the input. (quaddtype/numpy_quaddtype/src/ops.hpp
) [1] [2]NumPy ufunc integration
spacing
ufunc for both quad and long double types, making it available asnp.spacing
for QuadPrecision arrays. (quaddtype/numpy_quaddtype/src/umath/unary_ops.cpp
)Documentation update
spacing
as implemented and tested for both quad and long double dtypes. (quaddtype/release_tracker.md
)Test suite for
spacing
TestSpacing
class with parameterized tests covering NaN/infinity, sign preservation, zero, one, negative one, magnitude, subnormal range, and array inputs, ensuring correctness and alignment with NumPy's behavior. (quaddtype/tests/test_quaddtype.py
)