[Python-ideas] Suggestion: Extend integers to include iNaN
rosuav at gmail.com
Sun Sep 30 10:48:12 EDT 2018
On Mon, Oct 1, 2018 at 12:44 AM David Mertz <mertz at gnosis.cx> wrote:
> On Sun, Sep 30, 2018 at 10:23 AM Chris Angelico <rosuav at gmail.com> wrote:
>> On Mon, Oct 1, 2018 at 12:18 AM David Mertz <mertz at 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.
More information about the Python-ideas