caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Xavier Leroy <xavier.leroy@inria.fr>
To: Yaron Minsky <yminsky@cs.cornell.edu>
Cc: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Weird behavior with nan's and min/max
Date: Mon, 20 Oct 2003 16:24:38 +0200	[thread overview]
Message-ID: <20031020162438.A19276@pauillac.inria.fr> (raw)
In-Reply-To: <19541.141.155.88.179.1066657390.squirrel@minsky-primus.homeip.net>; from yminsky@cs.cornell.edu on Mon, Oct 20, 2003 at 09:43:10AM -0400

> > Pervasive.compare must be a total order, so it would need to throw an
> > exception if its arguments are unordered (e.g. one is "nan").
> > The other comparisons (=, <, etc) could implement a partial order,
> > returning "false" in the "unordered" case (except for <>, which should
> > return "true" in this case).
> 
> OK, so this makes me feel a little better -- turns out the polymorphic
> compare is a total order.

I should have been clearer: "would need to..." implies that the
current implementation doesn't do this; only the alternate
implementations that I suggested in a previous message could (and
should) behave this way.

> There is some remaining weirdness though (as
> one would expect), in that the polymorphic nan is equal to everything
> else.

Again, it's a problem (the problem?) with the current implementation,
and it needs fixing.

> I suppose it's too late to change this kind of behavior, but wouldn't it
> make more sense for nan to be different from everything but itself?

Yes, that would be much better.  According to IEEE, nan should even be
different from itself...

> Maybe make nan the smallest thing bigger than -infinitiy, or the
> largest thing smaller than infinity?

This isn't what IEEE does.

> By the way, in my context, there are plenty of times where it makes sense
> to have sets and maps of things that contain floating point numbers
> (although rarely of floating point numbers proper.)  

I'd be interested in some examples, but we can continue this
discussion off the list.

- Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2003-10-20 14:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-14 14:37 Yaron Minsky
2003-10-14 14:56 ` Yaron Minsky
2003-10-14 20:52   ` Yaron Minsky
2003-10-14 23:43     ` skaller
2003-10-16 17:29       ` Hendrik Tews
2003-10-16 13:16 ` Xavier Leroy
2003-10-16 14:01   ` Yaron Minsky
2003-10-17  9:26     ` [Caml-list] Test nan (was: Weird behavior with nan's and min/max) Christophe TROESTLER
2003-10-16 21:40   ` [Caml-list] Weird behavior with nan's and min/max Yaron Minsky
2003-10-16 21:50     ` Yaron Minsky
2003-10-16 22:52     ` Damien Doligez
2003-10-17 14:55   ` skaller
2003-10-17 15:14     ` Floating point exceptions (Was Re: [Caml-list] Weird behavior with nan's and min/max) Yaron Minsky
2003-10-17 23:55     ` [Caml-list] Weird behavior with nan's and min/max Yaron M. Minsky
2003-10-20 13:29       ` Xavier Leroy
2003-10-20 13:43         ` Yaron Minsky
2003-10-20 14:24           ` Xavier Leroy [this message]
2003-10-16 23:55 ` [Caml-list] " Jed Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031020162438.A19276@pauillac.inria.fr \
    --to=xavier.leroy@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=yminsky@cs.cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).