On Mon, 2014-03-03 at 22:26 +0100, Eelco Hoogendoorn wrote:
> The tuple gets cast to an ndarray; which invokes a different codepath
> than the scalar addition.
> 
> 
> Somehow, numpy has gotten more aggressive at upcasting to float64 as
> of 1.8, but I havnt been able to discover the logic behind it either

There were changes in the casting logic in 1.7, I think. I can't really
remember changes after that, so if there is a change, we might want to
check it out. (Or I am just missing something completly :))

- Sebastian
> 
> On Mon, Mar 3, 2014 at 10:06 PM, Nicolas Rougier
> <[email protected]> wrote:
>         
>         Hi all,
>         
>         I'm using numpy 1.8.0 (osx 10.9, python 2.7.6) and I can't
>         understand dtype promotion in the following case:
>         
>         >>> Z = np.zeros((2,2),dtype=np.float32) + 1
>         >>> print Z.dtype
>         float32
>         
>         >>> Z = np.zeros((2,2),dtype=np.float32) + (1,1)
>         >>> print Z.dtype
>         float64
>         
>         
>         Is this the expected behavior ?
>         What it the difference between the two lines ?
>         
>         
>         
>         Nicolas
>         _______________________________________________
>         NumPy-Discussion mailing list
>         [email protected]
>         http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> [email protected]
> http://mail.scipy.org/mailman/listinfo/numpy-discussion


_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to