Alex Rivera | Logout

How do programming languages handle huge number arithmetic

Asked 2009-09-17T13:03:21.463
15

For a computer working with a 64 bit processor, the largest number that it can handle would be 264 = 18,446,744,073,709,551,616. How does programming languages, say Java or be it C, C++ handle arithmetic of numbers higher than this value. Any register cannot hold it as a single piece. How was this issue tackled?

Edit
Report

1 Answer

0

Think of one machine-size number as a digit and apply the algorithm for multi-digit multiplication from primary school. Then you don't need to keep the whole numbers in registers, just the digits as they are worked on.

answered 2009-09-17T13:15:26.213

Your Answer