Two boolean arrays are not more compact than one signed `int8` array. But
since you'd have to make bool masks from such an array anyways to do
anything useful, you might as well pass the bool masks.

I think this example shows that you don't need any special infrastructure
from numpy. I don't think there is going to be much appetite to expand our
API in this direction.

On Thu, Apr 27, 2023 at 9:13 AM <jmsa...@gmail.com> wrote:

> > Ideally if there is an overflow in an array operation I'd like to
> produce an "overflow array" that's the same size as the result array, but
> with the values +1 if it's a positive overflow or -1 if it's a negative
> overflow.
>
> Alternatively, if boolean arrays are a much more compact memory footprint,
> then return two overflow arrays, one positive and one negative.
>
> Use case:
>
> X = ... something ...
> Y = ... something else ...
> Z, ovpos, ovneg = multiply_check_ov(X,Y)
> if ovpos.any():
>    np.iinfo(Z.dtype).max
> if ovneg.any():
>    # uh oh, something we didn't expect, so raise an error
> _______________________________________________
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: robert.k...@gmail.com
>


-- 
Robert Kern
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to