> 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: arch...@mail-archive.com

Reply via email to