[PPL-devel] Re: [Yap-users] Big problems with not-so-big numbers

Roberto Bagnara bagnara at cs.unipr.it
Wed Jan 25 14:19:10 CET 2006


Vitor Santos Costa wrote:
> 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.

Dear Vitor,

thanks for the fix.  Now things work on 32-bit architectures,
but the problem seems to persist for 64-bit ones.  Here is what
happens on an x86_64:

$ yap
% Restoring file /home2/bagnara/lib/Yap/startup
YAP version Yap-5.1.0
    ?- load_foreign_files(['bug'],[],init).
yes
    ?- long_min(M).
M = -9223372036854775808 ?
yes
    ?- long_min(M), M == -9223372036854775808.
no
    ?- long_min(M), M = -9223372036854775808.
no
    ?- long_min(M), M = 0 - 9223372036854775808.
no
    ?- long_min(M), M1 is abs(M).
M = M1 = -9223372036854775808 ?
yes
    ?- $

The code is exactly as in my original report.
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 at cs.unipr.it



More information about the PPL-devel mailing list