On Fri, Nov 13, 2009 at 6:18 PM, Adam Olsen <rha...@gmail.com> wrote: > On Mon, Nov 9, 2009 at 06:01, Mark Dickinson <dicki...@gmail.com> wrote: >> Well, when running in some form of 'non-stop' mode, where (quiet) NaN >> results are supposed to be propagated to the end of a computation, you >> certainly want equality comparisons with nan just to silently return false. >> E.g., in code like: >> >> if x == 0: >> <deal with zero special case> >> else: >> <usual algorithm> >> >> nans should just end up in the second branch, without the programmer >> having had to think about it too hard. > > if x != 0: > <usual algorithm> > else: > <deal with zero special case> > > nans should just end up in the first branch, without the programmer > having had to think about it too hard.
And they do: nan != 0 returns False. Maybe I'm missing your point here? > IEEE 754 is intended for a very different context. I don't think it > makes sense to attempt literal conformance to it. I disagree. The decimal specification is tied closely to IEEE 754 (the 2008 version), to the extent that even minor changes made by the 754r working group were mirrored in the decimal specification as it evolved; it only stopped evolving after IEEE 754-2008 was complete. IEEE 754-2008 also makes a point of targeting languages, rather than just floating-point hardware; to me it seems very much applicable to decimal.py. Mark _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com