-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Is there a straightforward way to pass numpy.float128 arguments to C++? #1785
Comments
TTBOMK, there may not be a straightforward "scalar" caster for NumPy types that are not directly tied to Python types (e.g. As a first step, here's showing Next step would be to just lie to |
Hm... Trying out a Also, through the current API, I'm not sure how to enforce a scalar I'm not sure if that's what's causing the circular 'base' error... |
Ah, was just not releasing references correctly. Working code: |
Thanks a lot for looking into this! I have tried to compile your code, but got:
(Don't worry about the file names, I just replaced my C++ code with your file.) |
Oops! Sorry I didn't see this earlier! Huh... TBH, I dunno... I've hacked around with doing custom dtypes, and I didn't have to make However, @a-sevin also ran into that same thing here: Are you right at |
Yes, to the best of my knowledge. I probably won't be able to require |
I'd like to pass an object of type numpy.float128 from Python to a C++ function wrapped by pybind11. My first attempt was to simply use "long double" as argument type on the C++ side, but the values I'm passing are truncated to about "double" accuracy - I expect this happens because the value is cast to a standard Python "float" somewhere on the way.
What would be the proper way to achieve this?
The text was updated successfully, but these errors were encountered: