<br><br><div class="gmail_quote">On Thu, Nov 15, 2012 at 8:24 PM, Gökhan Sever <span dir="ltr"><<a href="mailto:gokhansever@gmail.com" target="_blank">gokhansever@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<div><br></div><div>Could someone briefly explain why are these two operations are casting my float32 arrays to float64?</div><div><br></div><div><div>I1 (np.arange(5, dtype='float32')).dtype</div><div>O1 dtype('float32')</div>

<div><br></div><div>I2 (100000*np.arange(5, dtype='float32')).dtype</div><div>O2 dtype('float64')</div></div></blockquote><div><br>This one is depends on the size of the multiplier and is first present in 1.6.0. I suspect it is a side effect of making the type conversion code sensitive to magnitude.<br>
 <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br></div><div><br></div><div><br></div><div><div>I3 (np.arange(5, dtype='float32')[0]).dtype</div>

<div>O3 dtype('float32')</div></div><div><br></div><div>I4 (1*np.arange(5, dtype='float32')[0]).dtype</div><div>O4 dtype('float64')</div></div></blockquote><div><br>This one probably depends on the fact that the element is a scalar, but doesn't look right. Scalars are promoted differently. Also holds in numpy 1.5.0 so is of old provenance.<br>
<br>Chuck<br></div></div>