[Numpy-discussion] ufunc oddities
Charles R Harris
charlesr.harris@gmail....
Sat May 24 22:48:11 CDT 2008
On Sat, May 24, 2008 at 9:40 PM, Nathan Bell <wnbell@gmail.com> wrote:
> On Sat, May 24, 2008 at 10:32 PM, Charles R Harris
> <charlesr.harris@gmail.com> wrote:
> >
> > But the accumalator is of the same kind unless the kind is boolean, in
> which
> > case it is integer. Clear as a bell.
> >
>
> I believe the rule is that any integer type smaller than the machine
> word size is effectively upcast.
>
> IMO this is desirable since small types are very likely to overflow.
>
You can't overflow in modular arithmetic, which is how numpy is supposed to
work. Try
In [51]: x
Out[51]: array([2147483647, 2147483647])
In [52]: x.sum()
Out[52]: -2
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080524/2a4ec582/attachment.html
More information about the Numpy-discussion
mailing list