Version française
Home     About     Download     Resources     Contact us    
Browse thread
Equality of functional values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Fernando Alegre <fernando@c...>
Subject: Re: [Caml-list] Equality of functional values
On Tue, Jan 30, 2007 at 10:46:57PM +0100, Christophe TROESTLER wrote:
> On Tue, 30 Jan 2007, Fernando Alegre <fernando@cc.gatech.edu> wrote:
> > 
> > On Tue, Jan 30, 2007 at 10:01:41PM +0100, Christophe TROESTLER wrote:
> > > On Tue, 30 Jan 2007, Fernando Alegre <fernando@cc.gatech.edu> wrote:
> > > > 
> > > > Add a new operator =. for floating-point-aware equality that works on
> > > > everything the way = works now.
> > > > 
> > > > Would not this make everyone happy?
> > > 
> > > No. 
> > 
> > Why not?
> 
> Because, like several other people on this list, I am mostly writing
> numerical code and, while the behaviour w.r.t. NaN is only
> occasionally useful, it is good to have it as the standard (mandated
> by IEEE 754).

So you are happily using +. and *. for floats now. Why not use
a similar operator =. for float comparison?

The point is that floats in OCaml _are_ treated especially anyway.

> 
> See also http://caml.inria.fr/pub/ml-archives/caml-list/2001/02/bfbab5317267480356248b6e004c0eee.en.html

There are two separate notions of equality mixed together.
My point is, should "OCaml polymorphic equality" be the
same concept at "IEEE equality"?

Why not wish for three separate operators (=,== and =.)?

> 
> > Because that is no good for libraries.
> 
> Well, IMHO, for libraries you want to be able to declare the
> equality/comparison explicitely in the functions that need it (or else
> use a functor).


I mean external libraries which I would not like having to change
at every source file.

Fernando