Skip to content

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

Description

@SwayamInSync

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions