caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Markus Mottl <markus@oefai.at>
To: yminsky@cs.cornell.edu
Cc: Caml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] min, max and nan
Date: Thu, 15 Jul 2004 14:38:14 +0200	[thread overview]
Message-ID: <20040715123814.GB11971@fichte.ai.univie.ac.at> (raw)
In-Reply-To: <891bd3390407142051653aae76@mail.gmail.com>

On Wed, 14 Jul 2004, Yaron Minsky wrote:
> When using ocaml 3.07, I tried and failed to come up with a polymorphic
> min that behaved reasonably in this case, that is, that returned
> nan when either argument is nan.  With 3.08, this is now doable.
> Here's how it works:

Another possibility is to use "classify_float":

  let nmin x y =
    if classify_float x = FP_nan || classify_float y = FP_nan then nan
    else min x y

This is actually even more efficient.

> Still, we don't quite escape from the oddities of nan.  We still get
> order dependence in the case of larger data structures that include
> nan's:

I think this could be fixed by making use of the Obj-module, though this
would look a little bit messy.

Regards,
Markus

-- 
Markus Mottl          http://www.oefai.at/~markus          markus@oefai.at

-------------------
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:[~2004-07-15 12:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-15  3:51 Yaron Minsky
2004-07-15 12:38 ` Markus Mottl [this message]

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=20040715123814.GB11971@fichte.ai.univie.ac.at \
    --to=markus@oefai.at \
    --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).