Skip to content

Conversation

@SwayamInSync
Copy link
Member

closes #219

inline npy_byte
from_quad<npy_byte>(quad_value x, QuadBackendType backend)
{
// reduction ops often give warning, we can handle the NAN casting
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really understand this comment

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I should improve this comment, basically saying the runtime warnings we used to get often casting is the reason.
Casting from quad NaN or inf to double, etc Instead if we just catch and return for example in this case if we catch NaN and return NP_True then there will be no warnings otherwise that part will go through casting and leads to warnings.

I tested this but revert to original with just comment. Often different ops use casting in one way or another so when fixing that, knowing this information might be helpful

Copy link
Contributor

@juntyr juntyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, once the support is added to the release table

@SwayamInSync
Copy link
Member Author

once the support is added to the release table

Release table means?

@juntyr
Copy link
Contributor

juntyr commented Oct 30, 2025

once the support is added to the release table

Release table means?

Oh the release tracker

}

PyObject *DTypes = PyTuple_Pack(3, &PyArrayDescr_Type, &PyArrayDescr_Type, &PyArray_BoolDType);
PyObject *DTypes = PyTuple_Pack(3, Py_None, Py_None, Py_None);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seberg this has performance implications, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't change things really. The problem with this (but also the old version) is mostly that it doesn't define an order...
... and I am not sure what happens if another DType wants to do this as well, they might clash (depending on who is faster).

In general, I think it may be best to just not worry about performance at all, since we cache promotion results. The problem then being just that there isn't really a well defined order for multiple similar promoters (which is probably fine in practice, except that I think NumPy rejects it for now).

(I.e. maybe for promoters it should be fine to say "yeah, just try it no matter what DTypes come in")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SwayamInSync ideally, you probably just register it twice, once with the first being quaddtype and once with the second.
Maybe we should explicitly allow this (for multiple dtypes, but then it has undefined order), though.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally, you probably just register it twice

You mean registering promoter twice? I tried this regiserting the loop, it worked but undo because of code duplication.
I wanted the promoter to handle this stuff

@SwayamInSync
Copy link
Member Author

Thanks @juntyr @ngoldbaum @seberg so I guess this seems fine.
I am keeping it open, as there are some points I need to confirm from the NumPy's behaviour that seems kind of off to me (from the binary ops behaviour) didn't have the enough time to explore that.
If anything interesting comes out, will post and then we can merge it

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: all and any give UFuncTypeError

4 participants