From this question (How big can a 64bit signed integer be?), I learned that the biggest possible number to work with on a 64-bit machine is 2^64-1
, which is 92,233,720,368,547,758,070
. That means, even if I add 1
to it, it should return inf
. But it's not showing inf
. Here's what I'm observing:
>>> max = sys.maxsize
>>> format(max, ',')
'9,223,372,036,854,775,807'
>>> a = max * 10
>>> format(a, ',')
'92,233,720,368,547,758,070'
>>> a / max
10.0
Even if for some reason 92,233,720,368,547,758,070
is not the biggest number for Python, then what is the use of sys.maxsize
?
Secondly, shouldn't a 64-bit number take 64-bit memory space? Why both max
and a
are taking 36 bytes
?
>>> sys.getsizeof(max)
36
>>> sys.getsizeof(a)
36
Can anyone please describe both of the confusion?