[SciPy-dev] [SciPy-user] operations on int8 arrays
charles.harris at sdl.usu.edu
Thu Oct 20 12:16:11 CDT 2005
> It would be possible to make the default reduce type for integers 32-bit
> on 32-bit platforms and 64-bit on 64-bit platforms. the long integer type.
> Do people think that would be a good idea? These kinds of questions do
> come up.
I think it would be best to upcast the type. As others have pointed out, the
unexpected rollover of the sum can cause trouble. Rollover is even more of a
problem with the int8 type being used for booleans. I suppose one could always
typecast the array *before* summing or add a flag to indicate that a higher
precision should be used. Actually, loss of precision can even be a problem for
large float arrays that should really be accumulated in double precision and then,
so some sort of flag could be useful in any case. Using a larger type is unlikely
to cause space problems as the sum reduces the number of elements in the array.
Scipy-dev mailing list
Scipy-dev at scipy.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 3067 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/scipy-dev/attachments/20051020/b2a29bf4/attachment.bin
More information about the Scipy-dev