Search code examples
javabigintegerarbitrary-precision

What is the precise meaning of arbitrary precision?


This might be a very simple question for some but I would like to know the meaning of arbitrary precision which appears in the first line in JavaDoc of BigInteger :

Immutable arbitrary-precision integers .


Solution

  • The term fixed precision means that there are only a certain number of significant digits retained in the internal representation. This means that you would not be able to represent every integer with a magnitude greater than some threshold.

    With arbitrary precision integers, the integers can be as large as you need ("arbitrarily large") and the library will keep all the digits down to the least significant unit. (This is obviously limited by the amount of memory in your computer.)