[Numpy-discussion] Do we want scalar casting to behave as it does at the moment?
Tue Jan 8 17:36:03 CST 2013
Le mardi 8 janvier 2013, Andrew Collette a écrit :
> > 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,
> > 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.
My previous email may not have been clear enough, so to be sure: in my
above example, if the random number is 30000, then the result may
values (int16). If the random number is 50000, then the result will only
contain positive values (upcast to int32). Do you believe it is a good
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion