[Ilugc] Python Help - How it handles very large numbers ?

  • From: rajasuperman@xxxxxxxxx (Raja Subramanian)
  • Date: Sat Aug 9 13:51:55 2008

On Sat, Aug 9, 2008 at 7:27 AM, carti <carti@xxxxxxxxxxxxxx> wrote:

I read/learnt that, Python handles very large numbers easily and
gracefully using the long int.

Python's long int is an arbitrary precision data type -- it's a special
python object and not a native hardware data type.

Python's integer data type is the traditional C long int.

See
    http://docs.python.org/lib/typesnumeric.html
    http://www.python.org/doc/2.5.1/api/longObjects.html

and Python source code:
   Include/longintrepr.h
   Objects/longobject.c


Could someone point me to the correct link where I can learn how python
handles large numbers.

Python handles its arbitrary precision arithmetic internally, see the source
code files mentioned above.  Additional resources for arbitrary precision
arithmetic:

    http://en.wikipedia.org/wiki/Bignum
    http://gmplib.org/


If you are interested in number crunching with python, be sure to check
out http://numpy.scipy.org/.

- Raja

Other related posts: