<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Sep 18, 2014 at 10:44 AM, Petr Viktorin <span dir="ltr"><<a href="mailto:encukou@gmail.com" target="_blank">encukou@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="">> 2) the use-cases of the math lib and numpy are different, so they maybe<br>
> _should_ have different handling of this kind of thing.<br>
<br>
</span>If you have a reason for the difference, I'd like to hear it.</blockquote><div><br></div><div>For one, numpy does array operations, and you really don't want a ValueError (or any Exception) raised when perhaps only one value in a huge array has an issue. </div><div><br></div><div>The other is that numpy users are potentially more sophisticated with regard to numeric computing issues, and in any case, need to prioritize different things -- like performance over safety.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> But nan is not an integer value either:<br></span></blockquote><div><br></div><div>I meant conceptually.</div><div><br></div><div>sure -- it's not any number at all -- a NaN can be arrived at many ways, all it means something happened for which there was not an appropriate numerical answer -- even inf or -inf. So, the question is:</div><div><br></div><div>is the integer part of inf infinity? or it undefined, and therefor NaN ?</div><div><br></div><div>I can't image a use case where it would matter, which is probably why numpy returns inf.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> Perhaps float('inf') // 1 should raise a ValueError directly since there is<br>
> no proper way perform the floor division on infinity.<br></span></blockquote><div><br></div><div>not in numpy  for sure -- but I don't see the point in the math lib either, let the NaN propagate and deal with later if you need to -- that's what they are for.</div><div><br></div><div><br></div><div>- Chris </div><div><br></div><div><br></div></div>-- <br><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R            (206) 526-6959   voice<br>7600 Sand Point Way NE   (206) 526-6329   fax<br>Seattle, WA  98115       (206) 526-6317   main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a>
</div></div>