On Mon, Oct 1, 2018 at 12:44 AM David Mertz <me...@gnosis.cx> wrote:
>
> On Sun, Sep 30, 2018 at 10:23 AM Chris Angelico <ros...@gmail.com> wrote:
>>
>> On Mon, Oct 1, 2018 at 12:18 AM David Mertz <me...@gnosis.cx> wrote:
>> > Bonus points for anyone who knows the actual maximum size of Python ints 
>> > :-).
>>
>> Whatever the maximum is, it's insanely huge.
>> Want to share what the maximum actually is? I'm very curious!
>
>
> Indeed.  It's a lot bigger than any machine that will exist in my lifetime 
> can hold.
>
> int.bit_length() is stored as a system-native integer, e.g. 64-bit, rather 
> than recursively as a Python int.  So the largest Python int is 
> '2**sys.maxsize` (e.g. '2**(2**63-1)').  I may possibly have an off-by-one or 
> off-by-power-of-two in there :-).
>

Hah. Is that a fundamental limit based on the underlying
representation, or would it mean that bit_length would bomb with an
exception if the number is larger than that?

I'm not sure what's going on. I have a Py3 busily calculating
2**(2**65) and it's pegging a CPU core while progressively consuming
memory, but it responds to Ctrl-C, which suggests that Python bytecode
is still being executed.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to