[Numpy-discussion] Re: Managing integer overflow

2023-05-02 Thread jmsachs
> 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.

But I do! I'm looking for something that implements the multiply_check_ov(X,Y) 
and similar functionality for addition and subtraction, for large arrays; I 
don't know how to do that efficiently. (Or even correctly for 64-bit operands 
--- for 8/16/32 I suppose as a baseline I could do the math in 64-bit 
arithmetic and if the answer doesn't match, then use the sign bit of the 64-bit 
result for determining overflow.)
___
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


[Numpy-discussion] Re: Managing integer overflow

2023-05-02 Thread Sebastian Berg
On Mon, 2023-05-01 at 17:50 +, jmsa...@gmail.com wrote:
> > 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.
> 
> But I do! I'm looking for something that implements the
> multiply_check_ov(X,Y) and similar functionality for addition and
> subtraction, for large arrays; I don't know how to do that
> efficiently. (Or even correctly for 64-bit operands --- for 8/16/32 I
> suppose as a baseline I could do the math in 64-bit arithmetic and if
> the answer doesn't match, then use the sign bit of the 64-bit result
> for determining overflow.)


There are two things I could imagine.  First, improving the warnings
and maybe making some overflow errors (or optional).  This never
happened since it should come with performance impact and that should
be low.
Second, there could be a `BigInt` dtype that has full precision like
Python integers, but I would prefer such development to start outside
of NumPy first.

But, neither is even what you want probably.

So I agree, NumPy is probably not in a position to help you.  You can
implement the functions that you described yourself (i.e. with overflow
return indication).  And they will be fully compatible with NumPy (see
for example https://github.com/WarrenWeckesser/ufunclab or maybe via
jitters like numba).

- Sebastian


> ___
> 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: sebast...@sipsolutions.net
> 


___
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


[Numpy-discussion] Re: Google Season of Docs 2023 Project Roadmap

2023-05-02 Thread Mukulika Pahari
Your plan looks amazing, Mars! All the best for the project.
___
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