[eclipse-clp-users] Configure a unification to specify when two floats should be considered equal?

From: -dp- <david_at_...151...>
Date: Tue, 9 Feb 2010 13:51:12 +0800
Is there a way to configure a particular call to unification to require that
any floats or doubles within the compounds should be considered equal if,
say, they are the same up to some configured number of decimal places?

For example, I would like to provide some argument to operator = here,

  p(X) = p(Y)           or    =(p(X), p(Y))

so that if X and Y happen to be the same for their integer part and the
first, say, three significant digits of their fractional part, then the
unification should succeed.

I'm pretty sure there is no such feature, but it seemed worth asking since
unifying is fairly pointless if the args are compounds and there's a chance
there's a float somewhere in either of them.

The best alternative I can think of is to write my own unifier predicate and
add this feature.

David
Received on Tue Feb 09 2010 - 06:58:22 CET

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST