Hi there! I'm looking at options for fixed-point math, and none of the existing 
Python modules (https://github.com/smlgit/fpbinary, 
https://github.com/francof2a/fxpmath, etc.) seem to check the right boxes, so 
I'm thinking about creating my own, and maybe contributing it to numpy.

Are there any facilities in numpy to manage integer overflow in 
addition/subtraction/multiplication of values with identical dtypes? The 
default behavior with integer types like np.uint8 appears to be twos-complement 
wrapping syntax with an optional warning (or exception or whatever via 
np.seterr), and that's well-designed, but not as helpful as what I'd like to 
see in some cases where I'm willing to sacrifice some speed to provide 
feedback. 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. 
That way I can either raise an exception or saturate the output.

If there are not such facilities already --- and again, I don't want to burden 
the default operations with this kind of behavior, but would like to see some 
way of facilitating this behavior through some mechanism --- let me know and I 
will open up a feature request.

--Jason
_______________________________________________
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