<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
,	O
also	O
called	O
bignum	B-Algorithm
arithmetic	I-Algorithm
,	O
multiple-precision	O
arithmetic	O
,	O
or	O
sometimes	O
infinite-precision	B-Algorithm
arithmetic	I-Algorithm
,	O
indicates	O
that	O
calculations	O
are	O
performed	O
on	O
numbers	O
whose	O
digits	O
of	O
precision	B-Architecture
are	O
limited	O
only	O
by	O
the	O
available	O
memory	B-General_Concept
of	O
the	O
host	O
system	O
.	O
</s>
<s>
This	O
contrasts	O
with	O
the	O
faster	O
fixed-precision	O
arithmetic	O
found	O
in	O
most	O
arithmetic	B-General_Concept
logic	I-General_Concept
unit	I-General_Concept
(	O
ALU	O
)	O
hardware	O
,	O
which	O
typically	O
offers	O
between	O
8	O
and	O
64	O
bits	O
of	O
precision	B-Architecture
.	O
</s>
<s>
Several	O
modern	O
programming	O
languages	O
have	O
built-in	O
support	O
for	O
bignums	B-Algorithm
,	O
and	O
others	O
have	O
libraries	O
available	O
for	O
arbitrary-precision	B-Algorithm
integer	O
and	O
floating-point	B-Algorithm
math	I-Algorithm
.	O
</s>
<s>
Rather	O
than	O
storing	O
values	O
as	O
a	O
fixed	O
number	O
of	O
bits	O
related	O
to	O
the	O
size	O
of	O
the	O
processor	B-General_Concept
register	I-General_Concept
,	O
these	O
implementations	O
typically	O
use	O
variable-length	O
arrays	B-Data_Structure
of	O
digits	O
.	O
</s>
<s>
Arbitrary	B-Algorithm
precision	I-Algorithm
is	O
used	O
in	O
applications	O
where	O
the	O
speed	O
of	O
arithmetic	O
is	O
not	O
a	O
limiting	O
factor	O
,	O
or	O
where	O
precise	O
results	O
with	O
very	O
large	O
numbers	O
are	O
required	O
.	O
</s>
<s>
It	O
should	O
not	O
be	O
confused	O
with	O
the	O
symbolic	B-Algorithm
computation	I-Algorithm
provided	O
by	O
many	O
computer	B-General_Concept
algebra	I-General_Concept
systems	I-General_Concept
,	O
which	O
represent	O
numbers	O
by	O
expressions	O
such	O
as	O
,	O
and	O
can	O
thus	O
represent	O
any	O
computable	O
number	O
with	O
infinite	B-Algorithm
precision	I-Algorithm
.	O
</s>
<s>
A	O
common	O
application	O
is	O
public-key	B-Application
cryptography	I-Application
,	O
whose	O
algorithms	O
commonly	O
employ	O
arithmetic	O
with	O
integers	O
having	O
hundreds	O
of	O
digits	O
.	O
</s>
<s>
Another	O
is	O
in	O
situations	O
where	O
artificial	O
limits	O
and	O
overflows	B-Algorithm
would	O
be	O
inappropriate	O
.	O
</s>
<s>
It	O
is	O
also	O
useful	O
for	O
checking	O
the	O
results	O
of	O
fixed-precision	O
calculations	O
,	O
and	O
for	O
determining	O
optimal	O
or	O
near-optimal	O
values	O
for	O
coefficients	O
needed	O
in	O
formulae	O
,	O
for	O
example	O
the	O
that	O
appears	O
in	O
Gaussian	B-Algorithm
integration	I-Algorithm
.	O
</s>
<s>
Arbitrary	B-Algorithm
precision	I-Algorithm
arithmetic	I-Algorithm
is	O
also	O
used	O
to	O
compute	O
fundamental	O
mathematical	O
constants	O
such	O
as	O
π	O
to	O
millions	O
or	O
more	O
digits	O
and	O
to	O
analyze	O
the	O
properties	O
of	O
the	O
digit	O
strings	O
or	O
more	O
generally	O
to	O
investigate	O
the	O
precise	O
behaviour	O
of	O
functions	O
such	O
as	O
the	O
Riemann	O
zeta	O
function	O
where	O
certain	O
questions	O
are	O
difficult	O
to	O
explore	O
via	O
analytical	O
methods	O
.	O
</s>
<s>
Another	O
example	O
is	O
in	O
rendering	O
fractal	B-Application
images	O
with	O
an	O
extremely	O
high	O
magnification	O
,	O
such	O
as	O
those	O
found	O
in	O
the	B-Algorithm
Mandelbrot	I-Algorithm
set	I-Algorithm
.	O
</s>
<s>
Arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
can	O
also	O
be	O
used	O
to	O
avoid	O
overflow	B-Algorithm
,	O
which	O
is	O
an	O
inherent	O
limitation	O
of	O
fixed-precision	O
arithmetic	O
.	O
</s>
<s>
Similar	O
to	O
a	O
5-digit	O
odometer	O
's	O
display	O
which	O
changes	O
from	O
99999	O
to	O
00000	O
,	O
a	O
fixed-precision	O
integer	O
may	O
exhibit	O
wraparound	B-Error_Name
if	O
numbers	O
grow	O
too	O
large	O
to	O
represent	O
at	O
the	O
fixed	O
level	O
of	O
precision	B-Architecture
.	O
</s>
<s>
Some	O
processors	O
can	O
instead	O
deal	O
with	O
overflow	B-Algorithm
by	O
saturation	B-Algorithm
,	O
which	O
means	O
that	O
if	O
a	O
result	O
would	O
be	O
unrepresentable	O
,	O
it	O
is	O
replaced	O
with	O
the	O
nearest	O
representable	O
value	O
.	O
</s>
<s>
(	O
With	O
16-bit	O
unsigned	O
saturation	B-Algorithm
,	O
adding	O
any	O
positive	O
amount	O
to	O
65535	O
would	O
yield	O
65535	O
.	O
)	O
</s>
<s>
Some	O
processors	O
can	O
generate	O
an	O
exception	B-General_Concept
if	O
an	O
arithmetic	O
result	O
exceeds	O
the	O
available	O
precision	B-Architecture
.	O
</s>
<s>
Where	O
necessary	O
,	O
the	O
exception	B-General_Concept
can	O
be	O
caught	O
and	O
recovered	O
from	O
—	O
for	O
instance	O
,	O
the	O
operation	O
could	O
be	O
restarted	O
in	O
software	O
using	O
arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
.	O
</s>
<s>
In	O
many	O
cases	O
,	O
the	O
task	O
or	O
the	O
programmer	O
can	O
guarantee	O
that	O
the	O
integer	O
values	O
in	O
a	O
specific	O
application	O
will	O
not	O
grow	O
large	O
enough	O
to	O
cause	O
an	O
overflow	B-Algorithm
.	O
</s>
<s>
A	O
programmer	O
may	O
design	O
the	O
computation	O
so	O
that	O
intermediate	O
results	O
stay	O
within	O
specified	O
precision	B-Architecture
boundaries	O
.	O
</s>
<s>
Some	O
programming	O
languages	O
such	O
as	O
Lisp	B-Language
,	O
Python	B-Language
,	O
Perl	B-Language
,	O
Haskell	B-Language
,	O
Ruby	B-Language
and	O
Raku	B-Application
use	O
,	O
or	O
have	O
an	O
option	O
to	O
use	O
,	O
arbitrary-precision	B-Algorithm
numbers	O
for	O
all	O
integer	O
arithmetic	O
.	O
</s>
<s>
Although	O
this	O
reduces	O
performance	O
,	O
it	O
eliminates	O
the	O
possibility	O
of	O
incorrect	O
results	O
(	O
or	O
exceptions	O
)	O
due	O
to	O
simple	O
overflow	B-Algorithm
.	O
</s>
<s>
The	O
exclusive	O
use	O
of	O
arbitrary-precision	B-Algorithm
numbers	O
in	O
a	O
programming	O
language	O
also	O
simplifies	O
the	O
language	O
,	O
because	O
a	O
number	O
is	O
a	O
number	O
and	O
there	O
is	O
no	O
need	O
for	O
multiple	O
types	O
to	O
represent	O
different	O
levels	O
of	O
precision	B-Architecture
.	O
</s>
<s>
Arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
is	O
considerably	O
slower	O
than	O
arithmetic	O
using	O
numbers	O
that	O
fit	O
entirely	O
within	O
processor	B-General_Concept
registers	I-General_Concept
,	O
since	O
the	O
latter	O
are	O
usually	O
implemented	O
in	O
hardware	B-General_Concept
arithmetic	I-General_Concept
whereas	O
the	O
former	O
must	O
be	O
implemented	O
in	O
software	O
.	O
</s>
<s>
Even	O
if	O
the	O
computer	O
lacks	O
hardware	O
for	O
certain	O
operations	O
(	O
such	O
as	O
integer	O
division	O
,	O
or	O
all	O
floating-point	B-Algorithm
operations	O
)	O
and	O
software	O
is	O
provided	O
instead	O
,	O
it	O
will	O
use	O
number	O
sizes	O
closely	O
related	O
to	O
the	O
available	O
hardware	O
registers	O
:	O
one	O
or	O
two	O
words	O
only	O
and	O
definitely	O
not	O
N	O
words	O
.	O
</s>
<s>
There	O
are	O
exceptions	O
,	O
as	O
certain	O
variable	O
word	O
length	O
machines	O
of	O
the	O
1950s	O
and	O
1960s	O
,	O
notably	O
the	O
IBM	B-Device
1620	I-Device
,	O
IBM	B-Device
1401	I-Device
and	O
the	O
Honeywell	O
Liberator	O
series	O
,	O
could	O
manipulate	O
numbers	O
bound	O
only	O
by	O
available	O
storage	O
,	O
with	O
an	O
extra	O
bit	O
that	O
delimited	O
the	O
value	O
.	O
</s>
<s>
Numbers	O
can	O
be	O
stored	O
in	O
a	O
fixed-point	O
format	O
,	O
or	O
in	O
a	O
floating-point	B-Algorithm
format	I-Algorithm
as	O
a	O
significand	B-Algorithm
multiplied	O
by	O
an	O
arbitrary	O
exponent	O
.	O
</s>
<s>
The	O
size	O
of	O
arbitrary-precision	B-Algorithm
numbers	O
is	O
limited	O
in	O
practice	O
by	O
the	O
total	O
storage	O
available	O
,	O
and	O
computation	O
time	O
.	O
</s>
<s>
Numerous	O
algorithms	O
have	O
been	O
developed	O
to	O
efficiently	O
perform	O
arithmetic	O
operations	O
on	O
numbers	O
stored	O
with	O
arbitrary	B-Algorithm
precision	I-Algorithm
.	O
</s>
<s>
For	O
multiplication	O
,	O
the	O
most	O
straightforward	O
algorithms	O
used	O
for	O
multiplying	O
numbers	O
by	O
hand	O
(	O
as	O
taught	O
in	O
primary	O
school	O
)	O
require	O
operations	O
,	O
but	O
multiplication	B-Algorithm
algorithms	I-Algorithm
that	O
achieve	O
complexity	O
have	O
been	O
devised	O
,	O
such	O
as	O
the	O
Schönhage	B-Algorithm
–	I-Algorithm
Strassen	I-Algorithm
algorithm	I-Algorithm
,	O
based	O
on	O
fast	O
Fourier	O
transforms	O
,	O
and	O
there	O
are	O
also	O
algorithms	O
with	O
slightly	O
worse	O
complexity	O
but	O
with	O
sometimes	O
superior	O
real-world	O
performance	O
for	O
smaller	O
.	O
</s>
<s>
The	B-Algorithm
Karatsuba	I-Algorithm
multiplication	I-Algorithm
is	O
such	O
an	O
algorithm	O
.	O
</s>
<s>
For	O
division	O
,	O
see	O
division	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
For	O
examples	O
in	O
x86	B-Operating_System
assembly	O
,	O
see	O
external	O
links	O
.	O
</s>
<s>
In	O
some	O
languages	O
such	O
as	O
REXX	B-Language
,	O
the	O
precision	B-Architecture
of	O
all	O
calculations	O
must	O
be	O
set	O
before	O
doing	O
a	O
calculation	O
.	O
</s>
<s>
Other	O
languages	O
,	O
such	O
as	O
Python	B-Language
and	O
Ruby	B-Language
,	O
extend	O
the	O
precision	B-Architecture
automatically	O
to	O
prevent	O
overflow	B-Algorithm
.	O
</s>
<s>
If	O
approximate	O
values	O
of	O
factorial	O
numbers	O
are	O
desired	O
,	O
Stirling	O
's	O
approximation	O
gives	O
good	O
results	O
using	O
floating-point	B-Algorithm
arithmetic	I-Algorithm
.	O
</s>
<s>
Even	O
floating-point	B-Algorithm
numbers	I-Algorithm
are	O
soon	O
outranged	O
,	O
so	O
it	O
may	O
help	O
to	O
recast	O
the	O
calculations	O
in	O
terms	O
of	O
the	O
logarithm	O
of	O
the	O
number	O
.	O
</s>
<s>
But	O
if	O
exact	O
values	O
for	O
large	O
factorials	O
are	O
desired	O
,	O
then	O
special	O
software	O
is	O
required	O
,	O
as	O
in	O
the	O
pseudocode	B-Language
that	O
follows	O
,	O
which	O
implements	O
the	O
classic	O
algorithm	O
to	O
calculate	O
1	O
,	O
1×2	O
,	O
1×2×3	O
,	O
1×2×3×4	O
,	O
etc	O
.	O
</s>
<s>
carry	O
:=	O
carry	O
div	O
Base	O
%	O
Strip	O
the	O
last	B-Architecture
digit	I-Architecture
off	O
the	O
carry	O
.	O
</s>
<s>
The	O
computer	O
may	O
also	O
offer	O
facilities	O
for	O
splitting	O
a	O
product	O
into	O
a	O
digit	O
and	O
carry	O
without	O
requiring	O
the	O
two	O
operations	O
of	O
mod	O
and	O
div	O
as	O
in	O
the	O
example	O
,	O
and	O
nearly	O
all	O
arithmetic	O
units	O
provide	O
a	O
carry	B-Algorithm
flag	I-Algorithm
which	O
can	O
be	O
exploited	O
in	O
multiple-precision	O
addition	O
and	O
subtraction	O
.	O
</s>
<s>
IBM	O
's	O
first	O
business	O
computer	O
,	O
the	O
IBM	B-Device
702	I-Device
(	O
a	O
vacuum-tube	O
machine	O
)	O
of	O
the	O
mid-1950s	O
,	O
implemented	O
integer	O
arithmetic	O
entirely	O
in	O
hardware	O
on	O
digit	O
strings	O
of	O
any	O
length	O
from	O
1	O
to	O
511	O
digits	O
.	O
</s>
<s>
The	O
earliest	O
widespread	O
software	O
implementation	O
of	O
arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
was	O
probably	O
that	O
in	O
Maclisp	B-Language
.	O
</s>
<s>
Later	O
,	O
around	O
1980	O
,	O
the	O
operating	B-General_Concept
systems	I-General_Concept
VAX/VMS	B-Operating_System
and	O
VM/CMS	B-Application
offered	O
bignum	B-Algorithm
facilities	O
as	O
a	O
collection	O
of	O
string	B-Language
functions	O
in	O
the	O
one	O
case	O
and	O
in	O
the	O
languages	O
EXEC	B-Application
2	I-Application
and	O
REXX	B-Language
in	O
the	O
other	O
.	O
</s>
<s>
An	O
early	O
widespread	O
implementation	O
was	O
available	O
via	O
the	O
IBM	B-Device
1620	I-Device
of	O
1959	O
–	O
1970	O
.	O
</s>
<s>
The	O
1620	O
was	O
a	O
decimal-digit	O
machine	O
which	O
used	O
discrete	O
transistors	O
,	O
yet	O
it	O
had	O
hardware	O
(	O
that	O
used	O
lookup	B-Data_Structure
tables	I-Data_Structure
)	O
to	O
perform	O
integer	O
arithmetic	O
on	O
digit	O
strings	O
of	O
a	O
length	O
that	O
could	O
be	O
from	O
two	O
to	O
whatever	O
memory	B-General_Concept
was	O
available	O
.	O
</s>
<s>
For	O
floating-point	B-Algorithm
arithmetic	I-Algorithm
,	O
the	O
mantissa	B-Algorithm
was	O
restricted	O
to	O
a	O
hundred	O
digits	O
or	O
fewer	O
,	O
and	O
the	O
exponent	O
was	O
restricted	O
to	O
two	O
digits	O
only	O
.	O
</s>
<s>
The	O
largest	O
memory	B-General_Concept
supplied	O
offered	O
60	O
000	O
digits	O
,	O
however	O
Fortran	B-Application
compilers	O
for	O
the	O
1620	O
settled	O
on	O
fixed	O
sizes	O
such	O
as	O
10	O
,	O
though	O
it	O
could	O
be	O
specified	O
on	O
a	O
control	O
card	O
if	O
the	O
default	O
was	O
not	O
satisfactory	O
.	O
</s>
<s>
Arbitrary-precision	B-Algorithm
arithmetic	I-Algorithm
in	O
most	O
computer	O
software	O
is	O
implemented	O
by	O
calling	O
an	O
external	O
library	B-Library
that	O
provides	O
data	O
types	O
and	O
subroutines	O
to	O
store	O
numbers	O
with	O
the	O
requested	O
precision	B-Architecture
and	O
to	O
perform	O
computations	O
.	O
</s>
<s>
Different	O
libraries	O
have	O
different	O
ways	O
of	O
representing	O
arbitrary-precision	B-Algorithm
numbers	O
,	O
some	O
libraries	O
work	O
only	O
with	O
integer	O
numbers	O
,	O
others	O
store	O
floating	B-Algorithm
point	I-Algorithm
numbers	I-Algorithm
in	O
a	O
variety	O
of	O
bases	O
(	O
decimal	O
or	O
binary	O
powers	O
)	O
.	O
</s>
<s>
Fundamentally	O
,	O
Turing	B-Architecture
machines	I-Architecture
cannot	O
represent	O
all	O
real	O
numbers	O
,	O
as	O
the	O
cardinality	B-Application
of	O
exceeds	O
the	O
cardinality	B-Application
of	O
.	O
</s>
