ScriptBasic wrote: ↑Tue Jun 04, 2019 1:28 am

Has BIGINT been a feature of Python from the beginning? If not, my addition of GMP to ScriptBasic would be no different.

Yes, Python 2 has always had arbitrary precision integers, I'm sure Python 1 and even Python 0.9 had them. In Python 2 you have

**integer** which is either 16 or 32 bit (depended mainly on the register size of the platform it is on) and for numbers outside that range there is

**long** which is the arbitrary precision integer type.

Most of the time if, say a function takes two integers and adds them, if the sum is greater than what an integer can hold then you return the answer as a long instead.

Python 3 merged the two in to a single

**int** type, as long as the value it holds is small enough to fit in the machine's registers it is stored exactly as a word, if it is over then Python uses a custom format whereby only the absolute of a number is stored, the sign is held in the sign of the size field of the number (so size 2 means +ve value stored in 2 words, size -2 means the +ve value stored in the two words is really a negative value). It stores 30 bits of the number in each word (15 on 16-bit cpus).