<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/10/edeefa11537d0dda03680616cfa6a82f"
  from="Yaron Minsky &lt;yminsky@c...&gt;"
  author="Yaron Minsky"
  date="2003-10-15T14:52:09"
  subject="[Caml-list] NaN-safe min and max"
  prev="2003/10/388ef9d6af03890527509606432ffb01"
  next="2003/10/e8b532a1e5370741fb38319486356a7f"
  next-in-thread="2003/10/270e39fd60ffa2c8337369bc60b01baf"
  prev-thread="2003/10/702773fd728055d4a47e1db53ea3cc20"
  next-thread="2003/10/5c8d3dca064ba4310c8e13954e431d6a"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] NaN-safe min and max">
<msg 
  url="2003/10/edeefa11537d0dda03680616cfa6a82f"
  from="Yaron Minsky &lt;yminsky@c...&gt;"
  author="Yaron Minsky"
  date="2003-10-15T14:52:09"
  subject="[Caml-list] NaN-safe min and max">
<msg 
  url="2003/10/270e39fd60ffa2c8337369bc60b01baf"
  from="Remi Vanicat &lt;vanicat@l...&gt;"
  author="Remi Vanicat"
  date="2003-10-15T17:03:31"
  subject="Re: [Caml-list] NaN-safe min and max">
<msg 
  url="2003/10/356d8db8c34fb8ca1c896dcb3fd55920"
  from="Remi Vanicat &lt;vanicat@l...&gt;"
  author="Remi Vanicat"
  date="2003-10-15T18:59:18"
  subject="Re: [Caml-list] NaN-safe min and max">
</msg>
<msg 
  url="2003/10/9867fd1f977ffdb30441fe90355a6474"
  from="Jacques Garrigue &lt;garrigue@k...&gt;"
  author="Jacques Garrigue"
  date="2003-10-16T01:13:45"
  subject="Re: [Caml-list] NaN-safe min and max">
</msg>
</msg>
</msg>
</thread>

<contents>
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 &amp;&amp; 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

</contents>

</message>

