[Numpy-discussion] (no subject)

Chris Barker chris.barker at noaa.gov
Thu Sep 18 13:01:38 EDT 2014


Well,

First of all, numpy and the python math module have a number of differences
when it comes to handling these kind of special cases -- and I think that:

1) numpy needs to do what makes the most sense for numpy and NOT mirror the
math lib.

2) the use-cases of the math lib and numpy are different, so they maybe
_should_ have different handling of this kind of thing.

3) I'm not sure that the core devs think these kinds of issues are "wrong"
'enough to break backward compatibility in subtle ways.

But it's a fun topic in any case, and maybe numpy's behavior could be
improved.

> My vote is that NumPy is correct here. I see no reason why
> >>> float('inf') / 1
> and
> >>> float('inf') // 1
>
> should return different results.
>

Well, one argument is that "floor division" is supposed to return an
integer value, and that inf is NOT an integer value. The integral part of
infinity doesn't exist and thus is Not a Number.

You also get some weird edge cases around the mod operator.

-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.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140918/e509c93b/attachment.html>


More information about the NumPy-Discussion mailing list