Thank you, Pauli. I guess this means that the test needs to be fixed?
Eugene
-Original Message-
From: numpy-discussion-boun...@scipy.org
[mailto:numpy-discussion-boun...@scipy.org] On Behalf Of Pauli Virtanen
Sent: Tuesday, May 14, 2013 3:31 PM
To: numpy-discussion@scipy.org
Subject: Re:
14.05.2013 21:52, Toder, Evgeny kirjoitti:
> So, does numpy implement modular (two’s complement)
> arithmetic for signed types
[clip]
Numpy leaves integer arithmetic to the C compiler.
Python and its C modules however by default specify -fwrapv for gcc and
its ilk, so the behavior might seem cons
C only does modular arithmetic for unsigned types. Signed types (like i2 used
here, is should be signed short) are not allowed to overflow in C. I.e. not
only is the result not guaranteed to be modular, or not guaranteed to be
consistent, the behavior of the whole program is not specified if it
On Tue, May 14, 2013 at 11:26 AM, Toder, Evgeny
wrote:
> Hello,
>
> ** **
>
> One of the test cases in test_einsum causes integer overflow for i2 type.
> The test goes like this:
>
> ** **
>
> >>> import numpy as np
>
> >>> dtype = 'i2'
>
> >>> n = 15
>
> >>> a = np.arange(4*n
Hello,
One of the test cases in test_einsum causes integer overflow for i2 type. The
test goes like this:
>>> import numpy as np
>>> dtype = 'i2'
>>> n = 15
>>> a = np.arange(4*n, dtype=dtype).reshape(4,n)
>>> b = np.arange(n*6, dtype=dtype).reshape(n,6)
>>> c = np.arange(24, dtype=dtype).reshap