FD with large domains

Fred Bapst <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
Hello,

I'd like to point out a couple of questionable situations in GnuProlog when 
dealing with FD variables with large domains (eg default domain).

- A*B #= C.                           no
- fd_domain([A,B,C],0,1000000),
   A*B #= C.                           no
- fd_domain([A,B,C],0,10000000),
   A*B #= C.                           yes
- X#<1000000,  4321 rem X #= 1.       no
- X#<10000000, 4321 rem X #= 1.       yes
-   X*X #= Y.                         yes
- X*X*X #= Y.                         no
-  X**3 #= Y.                         yes

Some of these issues might be due to integer overflow. My "numerical problem 
sniffer" tool suggested for instance to double-check this code snippet from 
BipsFD/fd_math_fd.fd:

pl_xy_eq_z(fdv X, fdv Y, fdv Z) {
  ...
  start Z in min(X)*min(Y)..max(X)*max(Y)
}

Depending how it gets translated, the integer multiplication might overflow.

Am I off-topic? If not, do you think it is desirable to provide a "mode" where 
it is ensured that propagation rules avoids overflows that could crash a domain? 
Could it be proposed as a student project (for how many hours of work)?

Best regards.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.