Hi Sergey, using your code I obtained the same, wrong, result. I've sligtly modified your code, defining explicitly the domain of the variables, and this update has improved the search, i.e. I didn't get any "wrong answer". Here there the modified code: :-lib(ic). test(Result):- Result=[A,B,C,D], Result:: 1..100, A #> 0, B #> 0, C #> 0, D #> 0, A #=< B, B #=< C, C #=< D, A*A*A*A + B*B*B*B + C*C*C*C #= D*D*D*D, labeling([A, B, C, D]). ?- test(R). No (22.43s cpu) Please note that, increasing the domains bounds, the search will take a (really) longer time. Bye, Matteo. ________________________________ Da: Sergey Dymchenko <kit1980@gmail.com> A: eclipse-clp-users@lists.sourceforge.net Inviato: Venerdě 9 Marzo 2012 18:24 Oggetto: [eclipse-clp-users] Large integers and delayed goals Hi, I want to find positive natural numbers A, B, C, D, such that A^4 + B^4 + C^4 = D^4. My program do this: A #> 0, B #> 0, C #> 0, D #> 0, A #=< B, B #=< C, C #=< D, A*A*A*A + B*B*B*B + C*C*C*C #= D*D*D*D, labeling([A, B, C, D]) But I get incorrect result [1, 1, 9742, 9742] with 10 delayed goals. As far as I understand, the system finds that the result is imprecise, but correct enough because 9742^4 is a large number. Probably floating arithmetic is used, not big integers... Is there a way to force precise arithmetic for large integers? Sergey. ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ ECLiPSe-CLP-Users mailing list ECLiPSe-CLP-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/eclipse-clp-usersReceived on Tue Mar 13 2012 - 12:43:59 CET
This archive was generated by hypermail 2.2.0 : Wed Mar 14 2012 - 06:15:10 CET