Arbitrary-precision integer arithmetic
ID: arbitrary-precision-integer-arithmetic
Arbitrary-precision integer arithmetic performs exact addition, subtraction, multiplication, and integer division using as many machine words as the value requires. A typical representation stores a sign and digits in base , with each digit occupying one machine word. Carries propagate between words just as in written decimal arithmetic.
For example, can be stored exactly even when a single machine integer has only bits. The attainable size is limited by memory and execution time, rather than a fixed numeric range. The cost grows with the number of bits, so an arithmetic operation on a large value cannot automatically be counted as constant time.
New to topics? Read the docs here!