On Thu, Sep 18, 2014 at 10:44 AM, Petr Viktorin <encu...@gmail.com> wrote:

> > 2) the use-cases of the math lib and numpy are different, so they maybe
> > _should_ have different handling of this kind of thing.
>
> If you have a reason for the difference, I'd like to hear it.


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.

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.


> > But nan is not an integer value either:
>

I meant conceptually.

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:

is the integer part of inf infinity? or it undefined, and therefor NaN ?

I can't image a use case where it would matter, which is probably why numpy
returns inf.


> Perhaps float('inf') // 1 should raise a ValueError directly since there
> is
> > no proper way perform the floor division on infinity.
>

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.


- Chris


-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

chris.bar...@noaa.gov
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to