-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
BUG: Add promoter to ldexp
for python integers to prevent overflow
#29597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
What will happen with complex input? |
@mattip this only promotes integer inputs (Python scalar integer, actually), so the rest would stay the same? |
Thanks a for looking at this, this is very cool to see this use! I am curious if we can push this further and actually use the promoter always. That is, we:
|
Thanks, that extension makes a lot of sense! I tried implementing this, but it causes a segmentation fault. It seems to be due to the fact that Edit: that does seem to be it; reverting the operation for the first dtype and setting the others in this way doesn't crash (though of course the promotion doesn't work properly) |
Oh, hmmm, the pyfloat one should work ok probably, although the abstract version woukd be nicer. |
|
Fixes #29182.
Adds a promoter for first argument
PyArray_PyLongDType
toldexp
. It casts straight todouble
, not sure if that is more arbitrary than needed.Thanks for reviewing!