caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Peng Zang <peng.zang@gmail.com>
To: Christophe TROESTLER <Christophe.Troestler+ocaml@umh.ac.be>
Cc: caml-list@yquem.inria.fr, rajb@rice.edu
Subject: Re: [Caml-list] equality operators in OCaml
Date: Fri, 25 Jul 2008 08:04:14 -0400	[thread overview]
Message-ID: <200807250804.16528.peng.zang@gmail.com> (raw)
In-Reply-To: <20080725.123454.62538826676999671.Christophe.Troestler+ocaml@umh.ac.be>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Friday 25 July 2008 06:34:54 am Christophe TROESTLER wrote:
> On Thu, 24 Jul 2008 21:40:36 -0400, Peng Zang wrote:
> > On Thursday 24 July 2008 06:32:36 pm Jon Harrop wrote:
> > > There are some complications here. Firstly, NaN has multiple
> > > representations that may or may not be physically equal but is always
> > > structurally unequal to itself.
> >
> > Yeah, that always seemed broken to me.  If two things are physically
> > equal (they occupy the same memory space) it doesn't make sense for them
> > to be structurally unequal (contain different content).  Personally, one
> > of the first things I did is redefined (=) to fix this.
>
> Humm...  http://citeseer.ist.psu.edu/goldberg91what.html is certainly
> a good read...
>
> My 0.02€,
> C.

I second that.  Particularly relevant is how there is not one unique NaN but a 
family of them.  OCaml has three treatments for them:

1) (=) treats all NaNs as different (even if they may in fact, at the bit 
level, be the same)

2) (compare) treats all NaNs as the same (even if they may in fact, at the bit 
level be different)

3) (==) two NaNs are equal iff they share the same memory

(2) tends to come up the most often as you typically don't care what kind of 
NaN it is, as long as it is one.

Peng
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFIicFAfIRcEFL/JewRAiFkAJ46YFay72ONIDD7qk75/izt9ne8gACgvMzu
EYZkQb7fYAlEU+KXnixp7to=
=5iAB
-----END PGP SIGNATURE-----


  reply	other threads:[~2008-07-25 12:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-24 19:27 Raj Bandyopadhyay
2008-07-24 22:15 ` [Caml-list] " Vincent Hanquez
2008-07-24 22:32 ` Jon Harrop
2008-07-25  1:40   ` Peng Zang
2008-07-25 10:34     ` Christophe TROESTLER
2008-07-25 12:04       ` Peng Zang [this message]
2008-07-25 20:14     ` Matthew William Cox
2008-07-25 22:27       ` Peng Zang

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=200807250804.16528.peng.zang@gmail.com \
    --to=peng.zang@gmail.com \
    --cc=Christophe.Troestler+ocaml@umh.ac.be \
    --cc=caml-list@yquem.inria.fr \
    --cc=rajb@rice.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).