[Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

Andrew Collette andrew.collette at gmail.com
Tue Jan 8 17:51:28 EST 2013


Hi,

> Keep in mind that in the third option (current 1.6 behavior) the dtype is
> large enough to hold the random number, but not necessarily to hold the
> result. So for instance if x is an int16 array with only positive values,
> the result of this addition may contain negative values (or not, depending
> on the number being drawn). That's the part I feel is flawed with this
> behavior, it is quite unpredictable.

Yes, certainly.  But in either the proposed or 1.5 behavior, if the
values in x are close to the limits of the type, this can happen also.

Andrew



More information about the NumPy-Discussion mailing list