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 QAA12110; Wed, 15 Oct 2003 16:52:09 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA09411 for ; Wed, 15 Oct 2003 16:52:08 +0200 (MET DST) Received: from tisch.mail.mindspring.net (tisch.mail.mindspring.net [207.69.200.157]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h9FEq7110629 for ; Wed, 15 Oct 2003 16:52:08 +0200 (MET DST) Received: from user-0ccekej.cable.mindspring.com ([24.199.81.211] helo=minsky-primus.homeip.net) by tisch.mail.mindspring.net with smtp (Exim 3.33 #1) id 1A9n0R-0007iS-00 for caml-list@inria.fr; Wed, 15 Oct 2003 10:52:07 -0400 Received: from 141.155.88.179 (SquirrelMail authenticated user yminsky) by minsky-primus.homeip.net with HTTP; Wed, 15 Oct 2003 10:52:06 -0400 (EDT) Message-ID: <18220.141.155.88.179.1066229526.squirrel@minsky-primus.homeip.net> Date: Wed, 15 Oct 2003 10:52:06 -0400 (EDT) Subject: [Caml-list] NaN-safe min and max From: "Yaron Minsky" To: caml-list@inria.fr User-Agent: SquirrelMail/1.4.2-1 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal X-Loop: caml-list@inria.fr X-Spam: no; 0.00; yaron:01 minsky:01 yminsky:01 cornell:01 andrieu:01 pervasives:01 olivier:02 obj:03 obj:03 snippet:04 let:04 let:04 max:06 max:06 magic:09 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Olivier Andrieu proposed the following code for doing a safe min/max. Does anyone have any thoughts about this code snippet, and whether it is or is not a safe use of Obj.magic? let min a b = let o = Obj.repr a in if Obj.is_block o && Obj.tag o = Obj.double_tag then Obj.magic (fmin (Obj.magic a) (Obj.magic b)) else Pervasives.min a b ------------------- 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