[Numpy-discussion] bug ! arr.mean() outside arr.min() .. arr.max() range

Sebastian Haase haase at msg.ucsf.edu
Fri Aug 11 22:40:27 CDT 2006

Travis Oliphant wrote:
> Sebastian Haase wrote:
>> Hi!
>> b is a non-native byteorder array of type int16
>> but see further down: same after converting to native ...
>>>>> repr(b.dtype)
>> 'dtype('>i2')'
> The problem is no-doubt related to "wrapping" for integers.  Your total is
> getting too large to fit into the reducing data-type.
> What does
> d.sum() give you?
I can't check that particular array until Monday...

> You can add d.mean(dtype='d') to force reduction over doubles.
This almost sound like what I reported is something like a feature !?
Is there a sensible / generic way to avoid those "accident" ? Maybe it 
must be the default to reduce int8, uint8, int16, uint16 into doubles !?

- Sebastian

More information about the Numpy-discussion mailing list