<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 13, 2016 at 10:05 AM, Alan Isaac <span dir="ltr"><<a href="mailto:alan.isaac@gmail.com" target="_blank">alan.isaac@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 6/13/2016 4:47 AM, Antoine Pitrou wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Currently, the choice is simple: if you want an int output,<br>
have an int input; if you want a float output, have a float output.<br>
</blockquote>
<br>
<br></span>
That is a misunderstanding, which may be influencing the discussion.<br>
Examples of complications:<br>
<br>
>>> type(np.int8(2)**2)<br>
<type 'numpy.int32'><br>
>>> type(np.uint64(2)**np.int8(2))<br>
<type 'numpy.float64'><br>
<br>
I don't think anyone has proposed first principles<br>
from which the desirable behavior could be deduced.<br>
I do think reference to the reasoning used by other<br>
languages in making this decision could be helpful.</blockquote><div><br></div><div>I think the main principle is whether an operator is a "float" operator.</div><div><br></div><div>for example, I don't think anyone would expect sqrt(int) to return int, even if it would have exact results in a countable infinite number of cases (theoretically)</div><div><br></div><div>another case is division which moved from return-int to return-float definition in the py2 - py3 move.</div><div><br></div><div>My argument is that `**` is like integer division and sqrt where the domain where integer return are the correct numbers is too small to avoid headaches by users.</div><div><br></div><div>Josef</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="HOEnZb"><font color="#888888"><br>
<br>
Alan Isaac<br>
(on Windows)</font></span><div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org" target="_blank">NumPy-Discussion@scipy.org</a><br>
<a href="https://mail.scipy.org/mailman/listinfo/numpy-discussion" rel="noreferrer" target="_blank">https://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</div></div></blockquote></div><br></div></div>