Calculate Big Number

Dave Angel d at davea.name
Tue Jan 8 02:39:31 CET 2013


On 01/07/2013 08:22 PM, Nac Temha wrote:
> Thanks for reply. I wonder how quickly calculate big numbers. Can you
> explain me as theoretical? Because this numbers overflow size of integer
> and double.
Please don't top-post.  It makes the context totally out of order.

Python automatically promotes to long when doing integer arithmetic, and
the numbers grow too big.  And on version 3, there's no distinction. 
floats are not used, or there would be errors.

Your "wonder statement" is not complete, so I'm not sure what you're
asking.  Could you elaborate?  Are you asking to see the source code for
the python interpreter that's responsible for this?  Or an algorithm
that it might use?  Are you curious in a language-agnostic way how one
might do multiple-precision arithmetic?  I've written arithmetic
packages in PL/I and in BASIC, plus implemented the microcoded math in
one processor.  So, for example, I might explain how one could compute
X**Y when Y is a positive integer, without doing Y-1 multiplies.



-- 

DaveA




More information about the Python-list mailing list