users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange difference in FD between E*E and E**2


From: Daniel Diaz
Subject: Re: Strange difference in FD between E*E and E**2
Date: Wed, 28 Dec 2011 21:45:43 +0100

Thank you for this bug report.

I check this ASAP.

My first idea: the behavior of strangePower1/2 is due to the fact that FD vars 
can only take positive values. Anyway the behavior is incorrect. I'll try to 
fix this.

Daniel

Le 16 déc. 2011 à 15:17, Fred Bapst a écrit :

> Hello,
> 
> With the following code, strangePower1(A,B) gives one solution, where the 
> other versions give two:
> 
> strangePower1(A,B) :-
>       fd_domain([A,B],0,5),
>       (A-B)**2 #> 16,          % <-------
>       fd_labeling([A,B]).
> 
> strangePower2(A,B) :-
>       fd_domain([A,B],0,5),
>       (A-B)*(A-B) #> 16,       % <-------
>       fd_labeling([A,B]).
> 
> strangePower3(A,B) :-
>       fd_domain([A,B],0,5),
>       A**2 -2*A*B +B**2 #> 16, % <-------
>       fd_labeling([A,B]).
> 
> | ?- strangePower2(A,B).
>  A = 0  B = 5 ? a
>  A = 5  B = 0
>  (15 ms) no
> | ?- strangePower1(A,B).
>  A = 5 B = 0
>  yes
> 
> Can you explain why? Do you think this difference is reasonable from the 
> programmer's point of view?
> 
> Observed in gprolog-1.4.0, both in Win32 and Linux32.
> 
> Best regards.
> 
> _______________________________________________
> Users-prolog mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/users-prolog
> 
> -- 
> Ce message a ete verifie par MailScanner
> pour des virus ou des polluriels et rien de
> suspect n'a ete trouve.
> 


-- 
Ce message a ete verifie par MailScanner
pour des virus ou des polluriels et rien de
suspect n'a ete trouve.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]