numpy / numpy/numpy-quaddtype

BUG: mixed-backend ufuncs use inconsistent common-backend policies

Open
#113 1 comment 0 reactions 1 assignee View on GitHub

@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.
  • matmul rejects 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.