I added a semi-kludge now, that puts the min and max values in range, to MIN_ and MAX_INT32 respectively if the value was outside the range. (Only active if SIZEOF_INT_TYPE>4.)
The result is still somewhat disappointing. :-/
| > 1234567890; | (20) Result: 1234567890 | > 12345678900; | (21) Result: -539222988
| > sprintf("%x",0x80000000); | (16) Result: "-80000000" | > sprintf("%x",0x7fffffff+1); | (17) Result: "80000000"
| > int i=4; i=i*1000*1000*1000; | (10) Result: 4000000000 | > object_program(i); | (11) Result: 0 | > object_program(i*i); | (12) Result: Gmp.bignum | > i*i; | (13) Result: -1179869184000000000
Close. But not close enough. :-)
/ Mirar
Previous text:
2003-01-26 13:55: Subject: INT_TYPE = INT64 (Bz2)
I added a semi-kludge now, that puts the min and max values in range, to MIN_ and MAX_INT32 respectively if the value was outside the range. (Only active if SIZEOF_INT_TYPE>4.)
/ Mirar
Hm, F_NUMBER can only make 32-bit integers, so I added an F_NUMBER64 that combines two arguments to make a 64-bit integer.
Now everything except the Gmp.mpz conversion seems to work:
| > 1234567890; | (8) Result: 1234567890 | > 12345678900; | (9) Result: 12345678900
| > sprintf("%x",0x80000000); | (10) Result: "80000000" | > sprintf("%x",0x7fffffff+1); | (11) Result: "80000000"
Yay. :)
| > int i=4; i=i*1000*1000*1000; | (12) Result: 4000000000 | > object_program(i); | (13) Result: 0 | > object_program(i*i); | (14) Result: Gmp.bignum | > i*i; | (15) Result: -1179869184000000000
Doh.
/ Mirar
Previous text:
2003-01-26 14:06: Subject: INT_TYPE = INT64 (Bz2)
The result is still somewhat disappointing. :-/
| > 1234567890; | (20) Result: 1234567890 | > 12345678900; | (21) Result: -539222988
| > sprintf("%x",0x80000000); | (16) Result: "-80000000" | > sprintf("%x",0x7fffffff+1); | (17) Result: "80000000"
| > int i=4; i=i*1000*1000*1000; | (10) Result: 4000000000 | > object_program(i); | (11) Result: 0 | > object_program(i*i); | (12) Result: Gmp.bignum | > i*i; | (13) Result: -1179869184000000000
Close. But not close enough. :-)
/ Mirar
pike-devel@lists.lysator.liu.se