How do programming languages handle huge number arithmetic

前端 未结 9 1152
清酒与你
清酒与你 2021-02-05 19:35

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 J

9条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-05 20:18

    There are lots of specialized techniques for doing calculations on numbers larger than the register size. Some of them are outlined in this wikipedia article on arbitrary precision arithmetic

    Low level languages, like C and C++, leave large number calculations to the library of your choice. One notable one is the GNU Multi-Precision library. High level languages like Python, and others, integrate this into the core of the language, so normal numbers and very large numbers are identical to the programmer.

提交回复
热议问题