Skip to content

Conversation

@SwayamInSync
Copy link
Member

Copilot Summary

This pull request adds full support for the ldexp function (computing x * 2**exp) for quad precision types in the codebase. It introduces the mixed-type operation for quad and integer types, integrates the operation as a NumPy ufunc, and provides comprehensive tests to ensure correctness and edge case handling. The release tracker is updated to reflect this new support.

Quad precision ldexp implementation:

  • Added mixed-type operation functions quad_ldexp and ld_ldexp for quad and long double types, including proper handling of NaN, zero, and infinity cases in ops.hpp.

NumPy ufunc integration:

  • Implemented descriptor resolution and strided loop logic for the quad precision ldexp ufunc, and registered the ufunc with proper type promotion in binary_ops.cpp.
  • Registered the new ldexp ufunc in init_quad_binary_ops, making it available for use.

Testing and documentation:

  • Added a comprehensive test suite for the quad precision ldexp function, covering basic functionality, zero, infinity, NaN, overflow, and underflow cases in test_quaddtype.py.
  • Updated the release tracker to mark ldexp as implemented and tested for quad precision.

@SwayamInSync
Copy link
Member Author

I need to fix this, it seems the int is causing issue here

@SwayamInSync
Copy link
Member Author

great so indeed the issue was in the different system size of int. Let me clean the code and see if I can generalize it better

@SwayamInSync
Copy link
Member Author

SwayamInSync commented Oct 23, 2025

one more thing to note is that on these systems long double is 128 bit hence Sleef_quad is also getting mapped to long double

@SwayamInSync
Copy link
Member Author

@juntyr ready for review now

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 the nit addressed

Co-authored-by: Juniper Tyree <50025784+juntyr@users.noreply.github.com>
@juntyr
Copy link
Contributor

juntyr commented Oct 23, 2025

@SwayamInSync Ok, feel free to merge once CI is green

@SwayamInSync
Copy link
Member Author

Merging this!

@SwayamInSync SwayamInSync merged commit 6fa5535 into numpy:main Oct 23, 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