On Tue, Nov 1, 2011 at 12:14 PM, Ben Smith-Mannschott <bsmith.o...@gmail.com
> wrote:

>
> 2 Make NaN contagious
> ---------------------
>
> Define min and max to return NaN if and only if at least one of their
> arguments is NaN. This seems most in keeping with the (admittedly
> perverse) behavior of NaN as specified.
>
>
The behavior isn't perverse- there's a difference between numerical
comparisons and ordering.   To see why this is so, consider the case should
NaN = NaN.  For ordering (sorting, etc.), this makes perfect sense.
Numerically, however- sqrt(-1) = NaN, and sqrt(-2) = NaN as well, so if NaN
= NaN, then sqrt(-1) = sqrt(-2).  It's easy to get from there to all sorts
of fun conclusions, like 1 = 2, and so on.  The IEEE spec implements (to
the extent it can) *numerical* equality.  What most people want is ordering
(unless the want numerical equality).

Pretty much every language ever screws this up.

Brian

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to