[MLton] ML/Lisp/Scheme, =, eq?, eqv?, equal?
Bradley Lucier
lucier@math.purdue.edu
Mon, 23 Feb 2004 16:49:52 -0500
On Feb 23, 2004, at 4:41 PM, Henry Cejtin wrote:
> The problem with making ML reals an equality type is that
> floating point
> equality doesn't quite work as one would expect of an equality
> relation.
> Note, for example, that it is not reflexive (Nan is not `equal'
> to Nan).
Well, there are four types of "equal" in Scheme. To paraphrase
Clinton, it depends on what "equal" equals, hence my question about
"equality" in ML. With my changes to R4RS, = would not be reflexive but
eq?/eqv?/equal would be.
> Also a simple test for equality is almost certainly wrong (because
> of the
> nature of floating point operations).
As a numerical analyst and sometimes library writer/tester I tend to
disagree with this statement.
Brad