[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Numerical Comparison: "required coercions"

Having spoken with a number of Lisp users (as opposed to implementors),
the overwhelming consensus appears to be that "=" must act like a 
transitive operation.  I should think that this statement alone would 
be sufficient to clarify  sections 12.1 to 12.4 of CLtL.  Thus the 
phrase "required coercions" would have to take on a context-sensitive 
interpretation -- certain kinds of coercions are required when doing 
comparisons, others are required when doing operations like addition 
and multiplication.

I don't propose to fix up the inherent non-associativity of 
floating-point addition and multiplication;  this "feature" is a 
consequence of truncating information (i.e., "rounding" by whatever
rule) in order to return a result in the required format.  Note, 
however, that the comparison functions return a boolean value -- not 
a floating-point value -- and hence aren't subject to the same problems.
So I would think that differing kinds of coercions between the two
kinds of operations wouldn't violate reasonable expectations.

You're quite right that if IEEE specifies what to do when comparing
floats of differing precisions (e.g., single-float with double-float)
then we ought to go for that.  I don't know what it says.  How about 
it Richard J. Fateman, you usually know about these matters?

-- JonL --