Skip to content

Conversation

SwayamInSync
Copy link
Member

Copilot Summary

This pull request adds support for the logaddexp function (log(exp(x) + exp(y))) for quad-precision and long double types, including a numerically stable implementation and comprehensive tests. It also updates documentation to reflect this new support.

New logaddexp implementation and registration

  • Added a numerically stable implementation of logaddexp for both quad-precision (Sleef_quad) and long double types, handling edge cases such as NaN and infinities. (quaddtype/numpy_quaddtype/src/ops.hpp [1] [2]
  • Registered the new logaddexp operation as a universal function (ufunc) so it is available in the NumPy extension. (quaddtype/numpy_quaddtype/src/umath/binary_ops.cpp quaddtype/numpy_quaddtype/src/umath/binary_ops.cppR243-R245)

Testing enhancements

  • Added comprehensive parameterized tests for logaddexp, covering a wide range of values (regular, large, small, and special cases like inf/nan), and verifying mathematical properties and edge cases. (quaddtype/tests/test_quaddtype.py quaddtype/tests/test_quaddtype.pyR431-R530)
  • Improved test coverage for logarithmic functions and clarified assertion messages. (quaddtype/tests/test_quaddtype.py [1] [2]

Documentation

  • Updated the release tracker to indicate that logaddexp is now implemented and tested for both quad and long double types. (quaddtype/release_tracker.md quaddtype/release_tracker.mdL13-R13)

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, would it be possible to also implement the binary version in the same PR?

@SwayamInSync
Copy link
Member Author

LGTM, would it be possible to also implement the binary version in the same PR?

Yeah sure, With the help of some past work at NumPy, no we can happily move to implementing all the available ufuncs

@SwayamInSync
Copy link
Member Author

Cool let's take this in

@SwayamInSync SwayamInSync merged commit e47738c into numpy:main Oct 15, 2025
9 checks passed
@SwayamInSync SwayamInSync deleted the logaddexp branch October 15, 2025 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants