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

Daniel Diaz <[email protected]>
Newsgroups gmane.comp.gnu.prolog.general
Message-ID <[email protected]>
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
> [email protected]
> 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.
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.