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

From: -dp- <david_at_wooden-robot.net>
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.2.0 : Thu Feb 02 2012 - 02:31:58 CET