[expr int(9...9)] returns -1 ... Is this a bug?
Deleted1710132fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2007-04-30 15:35:16
Consider, % info pat 8.5a6 % expr int(9999999999999999999999999999999999999999999999) -1 but % info pat 8.4.14 % expr int(9999999999999999999999999999999999999999999999) integer value too large to represent Also get similar behaviour with wide(). Judging from the code the new behaviour should be to return the result that is the bottom sizeof(the-relevent-C-integer-type) bits of the argument (ExprIntFunc), but the result is getting set to -1. mp_mod_2d() looks a possible culprit.
afreddplain2007-04-30 23:28:40
Logged In: YES user_id=1386588 Originator: YES Doh... ought to have tried some other input numbers! I was only using long numbers of the form 99...9 and these happen to be be = N*(2**32) + (2**32 - 1) ie. when int()'d they should be -1. Adding another 9 to the test number is same as multiply by 10 and add 9. Add (-1 * 10 + 9) == -1 Funny :-)
afredd Deleted ticket [1710132fff].
[History diff]2007-04-30 23:29:52
Log in (anonymous is fine) to add a comment.