Performing some random experiments with factorial programs in C, Python, and Scheme. I came across this fact:
In C, using the data type "unsigned long long", the largest factorial I can print is 65. This is "9223372036854775808", which is 19 digits, as indicated.
In Python, I can find the factorial of a number equal to 999, which consists of a large number of digits, much more than 19.
How does CPython do this? Does it use a data type like ' octaword '?
Perhaps I am missing some fundamental facts. Therefore, I would appreciate some ideas and / or reading links. Thanks!
UPDATE: Thanks to everyone for the explanation. Does this mean that CPython uses the GNU Multi-precision library (or some other similar library)?
UPDATE 2: I'm looking for a Python implementation of 'bignum' in the sources. Where exactly is this? Its here at http://svn.python.org/view/python/trunk/Objects/longobject.c?view=markup . Thank you, Bayshampayan.
c python types integer
user59634
source share