
Thanks Roberto
It should be fixed in the CVS. Te c-interface was doing the right thing, but the scanner was reading this number as a bignum (because ithe absolute value is larger than MAX_INT). I fixed the bignum code to do the right check for whether you can represent the number as a small int.
Thanks!
Vitor
On 1/15/06, Roberto Bagnara bagnara@cs.unipr.it wrote:
Below the signature is everything needed to reproduce the problem under GNU/Linux. I have checked the YAP sources, but did not succeed in finding what may cause this behavior. All the best,
Roberto
-- Prof. Roberto Bagnara Computer Science Group Department of Mathematics, University of Parma, Italy http://www.cs.unipr.it/~bagnara/ mailto:bagnara@cs.unipr.it
$ cat bug.c #include <Yap/YapInterface.h> #include <limits.h>
YAP_Bool long_min(YAP_Term t) { return YAP_Unify(t, YAP_MkIntTerm(LONG_MIN)); }
YAP_Bool yap_stub_long_min() { YAP_Term arg1 = YAP_A(1); return long_min(arg1); }
void init() { YAP_UserCPredicate("long_min", (int(*)())(yap_stub_long_min), 1); } $ gcc -c -shared -fPIC bug.c $ ld -shared -o bug.so bug.o $ yap % Restoring file /usr/local/lib/Yap/startup YAP version Yap-5.1.0 ?- load_foreign_files(['bug'],[],init). yes ?- long_min(M). M = -2147483648 ? yes ?- long_min(M), M == -2147483648. no ?- long_min(M), M = -2147483648. no ?- long_min(M), M is 0 - 2147483648. no ?- long_min(M), M1 is abs(M). M = M1 = -2147483648 ? yes ?- $
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Yap-users mailing list Yap-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/yap-users