float("nan") in set or as key

Chris Angelico rosuav at gmail.com
Mon Jun 6 00:11:03 EDT 2011


On Mon, Jun 6, 2011 at 11:21 AM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> The intended behaviour is operations on "quiet NANs" should return NANs,
> but operations on "signalling NANs" should cause a trap, which can either
> be ignored, and converted into a quiet NAN, or treated as an exception.
>
> E.g. in Decimal: [snip]

So does this mean that:

a = 0.0/0.0
b = a + 1

(with signalling NANs) should trap on the second line but not the
first? That's the first "operation on a nan".

> http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
> (The article is seven years old now, but as far as I know, the criticisms
> still apply.)

Thanks, that's my travel-home literature for tonight! :) I read the
other two articles you sent me (asynchronously), and they're most
interesting. I'm definitely still inclined to avoid any sort of
floating point work if at all possible, but hey, this gives me more
topics to bore people with at parties! (Wait. I never get invited to
parties any more. I think my work on that front is complete.)

Chris Angelico



More information about the Python-list mailing list