BUG: mixed-backend ufuncs use inconsistent common-backend policies
Open
@SwayamInSync is already working on this.
Since Jul 25, 2026.
bug
- Dominant language
- Python
- Stars
- 24
- Forks
- 6
- Avg merge
- 5d 41m
- Merged PRs (30d)
- 3
Description
QuadPrecDType.common_instance selects the SLEEF backend for mixed SLEEF and long-double descriptors, since long double can widen to binary128.
Existing operations do not consistently follow that policy:
np.result_type(sleef, longdouble)selects SLEEF.- Binary ufunc resolvers select long double.
- Comparison resolvers select long double.
matmulrejects non-SLEEF inputs.
This makes result dtype and precision operation-dependent for the same pair of input descriptors.
After lossless inter-backend casting is available (see #112 ) , supported mixed-backend operations should consistently follow common_instance, preferably through a shared backend-selection helper.
Acceptance criteria:
result_type, arithmetic, comparisons, and dot-family loops agree on the common backend wherever both backends are supported.- Both operand orders produce the same result dtype.
- Precision-sensitive tests verify that promotion does not narrow through long double or double.
- Unsupported operations fail explicitly rather than applying a different promotion rule.
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.
Assessment
This issue has not been assessed yet.