From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.7 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 1F784BBAF for ; Sat, 26 Jul 2008 00:27:55 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsIAABTwiUhA6bjnlGdsb2JhbACSCkMBAQEBCQMKBxEDl0+FYw X-IronPort-AV: E=Sophos;i="4.31,254,1215381600"; d="scan'208";a="13464301" Received: from wr-out-0506.google.com ([64.233.184.231]) by mail2-smtp-roc.national.inria.fr with ESMTP; 26 Jul 2008 00:27:54 +0200 Received: by wr-out-0506.google.com with SMTP id c55so2400801wra.11 for ; Fri, 25 Jul 2008 15:27:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:reply-to:to:subject:date :user-agent:cc:references:in-reply-to:content-type :content-transfer-encoding:content-disposition:message-id; bh=rKywZUnInZu6Vjh5UdHEJ7UpT6ZrNNwY+DfGPcgdVBE=; b=h5ypoLpHw+E3muG21a7W+ErmluLo6QGZXyKo2MUsFY5VduftT5oFnOQWRAOMGXdQLO qL3A/SbLSOtRPg2a3yhZaXm6p9aD97UcJBNLbpchba/gfd/38dB5bOUh2iLeNQf6JzHO VdcP1oUdPbdSnJRm2DovQg5M+1HAUAZkt+Tc8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:reply-to:to:subject:date:user-agent:cc:references:in-reply-to :content-type:content-transfer-encoding:content-disposition :message-id; b=Nu2a0jAVjcSzaXrFurNA6BhZx2ykT3pUvRlWaeoiysK29MzH4aq4yQHcmhZ1v+Idj2 OVrCaxAr6jXzVmNLYDe0e91PkRHx9hgRxTAzsFRJezHCkjUVQEuUyKyKJdzBoKtyBVGa l30WYUB0+q+Y89wE4sjG3sD5ls6zzlynW//dg= Received: by 10.90.94.12 with SMTP id r12mr91276agb.23.1217024873454; Fri, 25 Jul 2008 15:27:53 -0700 (PDT) Received: from ?192.168.0.102? ( [24.99.180.210]) by mx.google.com with ESMTPS id b45sm7877498hsa.6.2008.07.25.15.27.52 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 25 Jul 2008 15:27:52 -0700 (PDT) From: Peng Zang Reply-To: peng.zang@gmail.com To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] equality operators in OCaml Date: Fri, 25 Jul 2008 18:27:48 -0400 User-Agent: KMail/1.9.7 Cc: Matthew William Cox References: <4888D7B7.8030703@rice.edu> <200807242140.40245.peng.zang@gmail.com> <20080725201421.GA6015@saturn.mattcox.ca> In-Reply-To: <20080725201421.GA6015@saturn.mattcox.ca> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807251827.51454.peng.zang@gmail.com> X-Spam: no; 0.00; ocaml:01 hash:01 structurally:01 redefined:01 ocaml:01 peng:98 peng:98 equality:01 idiom:01 wrote:01 wrote:01 caml-list:01 functions:01 fyi:02 numerical:03 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday 25 July 2008 04:14:22 pm Matthew William Cox wrote: > On Thu, Jul 24, 2008 at 09:40:36PM -0400, Peng Zang wrote: > > 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. > > It's not broken at all, but complient with a common and longstanding > idiom (at least amoung scientists working with numerical codes.) The way > we test for NaN is by comparing to itself, eg: > > if x = x then (* x is a number *) else (* x is NaN *) > > Matt Yeah, I just learned that today. But these days, most languages have functions for testing for NaN. OCaml has classify_float for example. Just FYI Peng -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFIilNnfIRcEFL/JewRAiRjAJ9jRQy37/JtI+nZ9fhiInp3HOvKWgCgtmIv k2koED9DunAM73PmaEPhnbg= =SaDz -----END PGP SIGNATURE-----