On 9/19/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
Keith Goodman wrote:
> In what order would you like argsort to sort the values -inf, nan, inf?
>
Ideally, -inf should sort first, inf should sort last and nan should
raise an exception if present.

-tim

That sounds right. Nan can't be compared because, well, it is undefined. For instance:

In [73]: a = arange(2)

In [74]: a/0
Out[74]: array([0, 0])

In [75]: a/0.0
Out[75]: array([              nan,               inf])

In [76]: a/(-0.0)
Out[76]: array([              nan,              -inf])

I.e., 0.0/0.0 is undefined. But unless the hardware generates the exception I would be loath to introduce checks in the code. Putting a check in the innermost loop of the sorts would cost significant time.

But look at the integer division by zero where the IEEE stuff has no relevence. That sure looks like a bug to me.
<snip>

Chuck

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to