Integer size and large integer parsing
-
So I was wondering about how much data can be stuffed in an int, mostly to find a large magic value I could use that cannot possibly be a valid array index (well; other experiments show that value may as well be assumed to be 1000000...) I could not find anything in the documentation, so I experimented.
The result is that calculations and output support 64 bit signed integers fine, but input only seems to go to 32 bit.
int INT_MIN = (-1) << 63 int INT_MAX = -(INT_MIN-1)
get correctly printed as min and max signed 64 bit values, but the corresponding hexadecimal or decimal representations
int INT_MIN = +/- 0x8000000000000000 int INT_MAX = 0x7fffffffffffffff
get cullet to +/- 1.
I'm not really interested in getting the parsing to work :) That would be a bonus, but absolute low priority. I just want to state that yes, please, keep them 64 bit.
-
@Z-Mann you can assign a number that use 64 bit if you use
a = int(big number)
. Your tests are very illustrative, thanks. For another discussion, have a look at this https://fuzearena.com/forum/post/13231 if you like. -
Ah, thanks, I'll keep that in mind if I ever need specific big numbers. I would have used 12345*100000+67890 or something. I'm wondering now how int() works if the plain number doesn't...
-
@Z-Mann First I thought its how the parser interprets plain numbers, but because it works for
int()
it must be the implementation of the operator=
. - Well, I guess everyone got bored to sleep after "First I thought". 😶