Hi, Fred
thank you for report.
it is due to how big expressions are split into simpler ones. This is done with new brand intermediate variables whose initial domain is 0..max_int. When 2 of these variables are multiplied (non-linearity) an overflow occurs and resulting in an empty domain (max < min). This is clearly a behavior we don"t want. I add it to my TODO list. A workaround consists in splitting by hand the _expression_ (as you did).
Ok, fine ! Now I understand.
By the way, my original code (for a CLP problem taken from a book) showing the "bug" was :

fractions1(Ls) :-
        Ls = [A,B,C,D,E,F,G,H,I],
        fd_domain(Ls, 1, 9),
        fd_all_different(Ls),
        BC #= 10*B+C, EF #= 10*E+F, HI #= 10*H+I,
        A*EF*HI + D*BC*HI + G*BC*EF #= BC*EF*HI,
        fd_labelingff(Ls).

Strange, I have no problem with this one !

Sorry, I mean the bug appears when we do not define the auxiliary variables BC, EF and HI... And now it is clear why this happens.

Thanks for your work (I use gprolog for several years for my course on logic programming, and I really appreciate it).

PS - Funny that the problem is finally due to an overflow : we have just finished a diploma work where we instrument java bytecode so that overflows are reported at runtime. So I'm particularly interested in examples of overflow-related bugs...


_______________________________________________
Users-prolog mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to