This site is updated infrequently. For up-to-date information, please visit the new OCaml website at ocaml.org.

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: 2007-01-30 (22:06) From: Fernando Alegre 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.

>

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

```