How do programming languages handle huge number arithmetic

前端 未结 9 1146
清酒与你
清酒与你 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:07

    In general, the language itself doesn't handle high-precision, high-accuracy large number arithmetic. It's far more likely that a library is written that uses alternate numerical methods to perform the desired operations.

    For example (I'm just making this up right now), such a library might emulate the actual techniques that you might use to perform that large number arithmetic by hand. Such libraries are generally much slower than using the built-in arithmetic, but occasionally the additional precision and accuracy is called for.

提交回复
热议问题