From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA22740; Thu, 15 Jul 2004 14:38:28 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA17678 for ; Thu, 15 Jul 2004 14:38:27 +0200 (MET DST) Received: from fichte.ai.univie.ac.at (fichte.ai.univie.ac.at [131.130.174.156]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6FCcQEV024586 for ; Thu, 15 Jul 2004 14:38:26 +0200 Received: from fichte.ai.univie.ac.at (markus@localhost [127.0.0.1]) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) with ESMTP id i6FCcEDu014665; Thu, 15 Jul 2004 14:38:14 +0200 Received: (from markus@localhost) by fichte.ai.univie.ac.at (8.12.3/8.12.3/Debian-6.6) id i6FCcEYf014664; Thu, 15 Jul 2004 14:38:14 +0200 Date: Thu, 15 Jul 2004 14:38:14 +0200 From: Markus Mottl To: yminsky@cs.cornell.edu Cc: Caml Mailing List Subject: Re: [Caml-list] min, max and nan Message-ID: <20040715123814.GB11971@fichte.ai.univie.ac.at> Mail-Followup-To: yminsky@cs.cornell.edu, Caml Mailing List References: <891bd3390407142051653aae76@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <891bd3390407142051653aae76@mail.gmail.com> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 40F67AC2.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 yaron:01 minsky:01 doable:01 ocaml:01 polymorphic:01 mottl:02 mottl:02 float:02 float:02 wrote:03 argument:03 messy:03 data:03 markus:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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