[comp.lang.prolog] Comparing numbers

leon@mandrill.CWRU.Edu (Leon Sterling) (11/17/87)

Bruce Holmes questions' are good examples of `kosher pigs',
i.e. strictly legalistic curiosities that can't (more realistically
shouldn't) arise.

In his example of type conversion, only one of the queries makes
sense, namely 1.0 =:= 1?  (The testing procedure is irrelevant.)
This is the ONLY Prolog predicate which does evaluation as part of its
comparison.
It is probably sensible for this goal to succeed, thouigh it would
not be unreasonable for =:= only to compare values of the same type.

The meta-logical test 1.0 == 1? should only be applied to non-ground
terms. If its behaviour must be defined, I feel strongly that the
query should fail. The real number 1.0 is not the same object as the 
integer 1.

The unification test 1.0 = 1? should also fail, it seems to me.
Do we want a list with one element, a say, to unify with a binary
tree with a single leaf node a?                                           

Roundoff behaviour is a question for implementing arithmetic,
and is irrelevant in language design.

            Leon Sterling