The key feature of the BIGNUM arithmetic is the following one:

that calculations are performed on numbers which digits of precision are limited only by the available memory of the host system.

Several languages have builtin support for bignum, here you are a non complete list:

  • Common Lisp
  • C#: System.Numerics.BigInteger
  • ColdFusion
  • D: standard library module std.bigint
  • Dart: the built-in int datatype implements arbitrary-precision arithmetic
  • Erlang: the built-in Integer datatype implements arbitrary-precision arithmetic.
  • Go: the standard library package big implements arbitrary-precision integers (Int type) and rational numbers (Rat type)
  • Haskell: the built-in Integer datatype implements arbitrary-precision arithmetic and the standard Data.Ratio module implements rational numbers.
  • Java: class java.math.BigInteger (integer), Class java.math.BigDecimal (decimal)
  • Perl: The bignum and bigrat pragmas provide BigNum and BigRational support for Perl.
  • Python: the built-in int (3.x) / long (2.x) integer type is of arbitrary precision. The Decimal class in the standard library module decimal has user definable precision.
  • Ruby: the built-in Bignum integer type is of arbitrary precision. The BigDecimal class in the standard library module bigdecimal has user definable precision.
  • Standard ML: The optional built-in IntInf structure implements the INTEGER signature and supports arbitrary-precision integers.

Common use of arbitrary-precision arithmetic

A common application is public-key cryptography (such as that in every modern Web browser), whose algorithms commonly employ arithmetic with integers having hundreds of digits.


Arbitrary-precision arithmetic can also be used to avoid overflow, which is an inherent limitation of fixed-precision arithmetic.

Another use is the computation of the factorial numbers.




Arbitrary-precision arithmetic is considerably slower than arithmetic using numbers that fit entirely within processor registers, since the latter are usually implemented in hardware arithmetic whereas the former must be implemented in software.

Numbers can be stored in a fixed-point format, or in a floating-point format as a significand multiplied by an arbitrary exponent. However, since division almost immediately introduces infinitely repeating sequences of digits (such as 4/7 in decimal, or 1/10 in binary), should this possibility arise then either the representation would be truncated at some satisfactory size or else rational numbers would be used: a large integer for the numerator and for the denominator. 

I found a fantastic book on the internet, this book has been placed in the public domain and explains almost all about the multiprecision arithmetic. From the theory to the implementation, you can also find the source code in C language.