[Numpy-discussion] Integers to integer powers, let's make a decision

Alan Isaac alan.isaac at gmail.com
Mon Jun 20 17:11:54 EDT 2016


On 6/10/2016 8:28 PM, Allan Haldane wrote:
> My understanding is that numpy never upcasts based on the values, it
> upcasts based on the datatype ranges.
>
> http://docs.scipy.org/doc/numpy-1.10.1/reference/ufuncs.html#casting-rules



 >>> (np.int64(2**6)*np.arange(5,dtype=np.int8)).dtype
dtype('int8')
 >>> (np.int64(2**7)*np.arange(5,dtype=np.int8)).dtype
dtype('int16')

fwiw,
Alan Isaac




More information about the NumPy-Discussion mailing list