<s>
Range	B-Algorithm
coding	I-Algorithm
(	O
or	O
range	B-Algorithm
encoding	I-Algorithm
)	O
is	O
an	O
entropy	B-Algorithm
coding	I-Algorithm
method	O
defined	O
by	O
G.NigelN.Martin	O
in	O
a	O
1979	O
paper	O
,	O
which	O
effectively	O
rediscovered	O
the	O
FIFO	O
arithmetic	B-Algorithm
code	I-Algorithm
first	O
introduced	O
by	O
Richard	O
Clark	O
Pasco	O
in	O
1976	O
.	O
</s>
<s>
Range	B-Algorithm
coding	I-Algorithm
is	O
very	O
similar	O
to	O
arithmetic	B-Algorithm
coding	I-Algorithm
,	O
except	O
that	O
coding	O
is	O
done	O
with	O
digits	O
in	O
any	O
base	O
,	O
instead	O
of	O
with	O
bits	O
,	O
and	O
so	O
it	O
is	O
faster	O
when	O
using	O
larger	O
bases	O
(	O
e.g.	O
</s>
<s>
a	O
byte	B-Application
)	O
at	O
small	O
cost	O
in	O
compression	O
efficiency	O
.	O
</s>
<s>
After	O
the	O
expiration	O
of	O
the	O
first	O
(	O
1978	O
)	O
arithmetic	B-Algorithm
coding	I-Algorithm
patent	O
,	O
range	B-Algorithm
coding	I-Algorithm
appeared	O
to	O
clearly	O
be	O
free	O
of	O
patent	O
encumbrances	O
.	O
</s>
<s>
This	O
particularly	O
drove	O
interest	O
in	O
the	O
technique	O
in	O
the	O
open	B-License
source	I-License
community	O
.	O
</s>
<s>
Since	O
that	O
time	O
,	O
patents	O
on	O
various	O
well-known	O
arithmetic	B-Algorithm
coding	I-Algorithm
techniques	O
have	O
also	O
expired	O
.	O
</s>
<s>
Range	B-Algorithm
coding	I-Algorithm
conceptually	O
encodes	O
all	O
the	O
symbols	O
of	O
the	O
message	O
into	O
one	O
number	O
,	O
unlike	O
Huffman	B-General_Concept
coding	I-General_Concept
which	O
assigns	O
each	O
symbol	O
a	O
bit-pattern	O
and	O
concatenates	O
all	O
the	O
bit-patterns	O
together	O
.	O
</s>
<s>
Thus	O
range	B-Algorithm
coding	I-Algorithm
can	O
achieve	O
greater	O
compression	O
ratios	O
than	O
the	O
one-bit-per-symbol	O
lower	O
bound	O
on	O
Huffman	B-General_Concept
coding	I-General_Concept
and	O
it	O
does	O
not	O
suffer	O
the	O
inefficiencies	O
that	O
Huffman	O
does	O
when	O
dealing	O
with	O
probabilities	O
that	O
are	O
not	O
an	O
exact	O
power	O
of	O
two	O
.	O
</s>
<s>
The	O
central	O
concept	O
behind	O
range	B-Algorithm
coding	I-Algorithm
is	O
this	O
:	O
given	O
a	O
large-enough	O
range	O
of	O
integers	O
,	O
and	O
a	O
probability	O
estimation	O
for	O
the	O
symbols	O
,	O
the	O
initial	O
range	O
can	O
easily	O
be	O
divided	O
into	O
sub-ranges	O
whose	O
sizes	O
are	O
proportional	O
to	O
the	O
probability	O
of	O
the	O
symbol	O
they	O
represent	O
.	O
</s>
<s>
For	O
this	O
example	O
it	O
is	O
assumed	O
that	O
the	O
decoder	O
knows	O
that	O
we	O
intend	O
to	O
encode	O
exactly	O
five	O
symbols	O
in	O
the	O
base	B-Application
10	I-Application
number	I-Application
system	I-Application
(	O
allowing	O
for	O
105	O
different	O
combinations	O
of	O
symbols	O
with	O
the	O
range	O
[	O
0	O
,	O
100000	O
)	O
)	O
using	O
the	O
probability	O
distribution	O
{	O
A	O
:	O
.60	O
;	O
B	O
:	O
.20	O
;	O
<EOM>	O
:	O
.20	O
}	O
.	O
</s>
<s>
They	O
have	O
been	O
introduced	O
by	O
our	O
use	O
of	O
base	B-Application
10	I-Application
rather	O
than	O
base	O
2	O
.	O
)	O
</s>
<s>
Base	B-Application
10	I-Application
was	O
used	O
in	O
this	O
example	O
,	O
but	O
a	O
real	O
implementation	O
would	O
just	O
use	O
binary	O
,	O
with	O
the	O
full	O
range	O
of	O
the	O
native	O
integer	O
data	O
type	O
.	O
</s>
<s>
Instead	O
of	O
emitting	O
a	O
digit	O
at	O
a	O
time	O
you	O
would	O
emit	O
a	O
byte	B-Application
at	O
a	O
time	O
and	O
use	O
a	O
byte-shift	O
operation	O
instead	O
of	O
multiplying	O
by	O
10	O
.	O
</s>
<s>
Arithmetic	B-Algorithm
coding	I-Algorithm
is	O
the	O
same	O
as	O
range	B-Algorithm
coding	I-Algorithm
,	O
but	O
with	O
the	O
integers	O
taken	O
as	O
being	O
the	O
numerators	O
of	O
fractions	O
.	O
</s>
<s>
Accordingly	O
,	O
the	O
resulting	O
arithmetic	B-Algorithm
code	I-Algorithm
is	O
interpreted	O
as	O
beginning	O
with	O
an	O
implicit	O
"	O
0	O
"	O
.	O
</s>
<s>
As	O
these	O
are	O
just	O
different	O
interpretations	O
of	O
the	O
same	O
coding	O
methods	O
,	O
and	O
as	O
the	O
resulting	O
arithmetic	O
and	O
range	O
codes	O
are	O
identical	O
,	O
each	O
arithmetic	B-Algorithm
coder	I-Algorithm
is	O
its	O
corresponding	O
range	B-Algorithm
encoder	I-Algorithm
,	O
and	O
vice	O
versa	O
.	O
</s>
<s>
In	O
other	O
words	O
,	O
arithmetic	B-Algorithm
coding	I-Algorithm
and	O
range	B-Algorithm
coding	I-Algorithm
are	O
just	O
two	O
,	O
slightly	O
different	O
ways	O
of	O
understanding	O
the	O
same	O
thing	O
.	O
</s>
<s>
In	O
practice	O
,	O
though	O
,	O
so-called	O
range	B-Algorithm
encoders	I-Algorithm
tend	O
to	O
be	O
implemented	O
pretty	O
much	O
as	O
described	O
in	O
Martin	O
's	O
paper	O
,	O
while	O
arithmetic	B-Algorithm
coders	I-Algorithm
more	O
generally	O
tend	O
not	O
to	O
be	O
called	O
range	B-Algorithm
encoders	I-Algorithm
.	O
</s>
<s>
An	O
often	O
noted	O
feature	O
of	O
such	O
range	B-Algorithm
encoders	I-Algorithm
is	O
the	O
tendency	O
to	O
perform	O
renormalization	O
a	O
byte	B-Application
at	O
a	O
time	O
,	O
rather	O
than	O
one	O
bit	O
at	O
a	O
time	O
(	O
as	O
is	O
usually	O
the	O
case	O
)	O
.	O
</s>
<s>
In	O
other	O
words	O
,	O
range	B-Algorithm
encoders	I-Algorithm
tend	O
to	O
use	O
bytes	B-Application
as	O
coding	O
digits	O
,	O
rather	O
than	O
bits	O
.	O
</s>
