Is there a straightforward way to pass numpy.float128 arguments to C++?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 18k
- Forks
- 2.3k
- Avg merge
- 5d 17h
- Merged PRs (30d)
- 10
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by tracing how pybind11 converts a numpy.float128 argument to a C++ long double, especially where it may become a Python float; done means identifying a supported conversion path or a clearly scoped change that preserves the requested precision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, numpy, python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100