[eclipse-clp-users] Integer exponentiation in ic

From: Matthew Skala <mskala_at_...203...>
Date: Sat, 4 May 2013 20:34:49 -0500 (CDT)
Exponentiation constraints don't seem to be exact; they produce real
intervals bracketing the correct answer, even when evaluated on
positive integers where the result must be integer too:

   [eclipse 1]: lib(ic).
   % blah blah
   Yes (0.13s cpu)
   [eclipse 2]: X#=2,Y#=2,Z#=X^Y.

   No (0.00s cpu)
   [eclipse 3]: X#=2,Y#=2,Z$=X^Y.

   X = 2
   Y = 2
   Z = 3.9999999999999987__4.0000000000000018

   Delayed goals:
	   0.69314718055994518__0.6931471805599454 =:=
	   2 =:= 1.9999999999999993__2.0000000000000009
   Yes (0.00s cpu)

It looks like it's translating the constraint Z#=X^Y into ln(Z)$=ln(X)*Y
behind the scenes, then failing because of the attempted assignment of a
real interval to an integer variable.  Is there any simple way to enforce
an exponentiation constraint on integers that will keep them integers and
propagate exact answers?

Matthew Skala
Postdoctoral Fellow, University of Manitoba
Received on Sun May 05 2013 - 01:53:07 CEST

This archive was generated by hypermail 2.3.0 : Tue May 14 2019 - 03:13:24 CEST