<s>
Fixed-point	O
number	O
representation	O
is	O
often	O
contrasted	O
to	O
the	O
more	O
complicated	O
and	O
computationally	O
demanding	O
floating-point	B-Algorithm
representation	I-Algorithm
.	O
</s>
<s>
The	O
most	O
common	O
variants	O
are	O
decimal	B-Application
(	O
base	O
10	O
)	O
and	O
binary	O
(	O
base	O
2	O
)	O
.	O
</s>
<s>
When	O
decimal	B-Application
fixed-point	O
numbers	O
are	O
displayed	O
for	O
human	O
reading	O
,	O
the	O
fraction	O
digits	O
are	O
usually	O
separated	O
from	O
those	O
of	O
the	O
integer	O
part	O
by	O
a	O
radix	O
character	O
(	O
usually	O
'	O
.	O
'	O
</s>
<s>
Since	O
most	O
modern	O
processors	B-General_Concept
have	O
fast	O
floating-point	B-General_Concept
unit	I-General_Concept
(	O
FPU	O
)	O
,	O
fixed-point	O
representations	O
are	O
now	O
used	O
only	O
in	O
special	O
situations	O
,	O
such	O
as	O
in	O
low-cost	O
embedded	B-Architecture
microprocessors	I-Architecture
and	O
microcontrollers	B-Architecture
;	O
in	O
applications	O
that	O
demand	O
high	O
speed	O
and/or	O
low	O
power	O
consumption	O
and/or	O
small	O
chip	O
area	O
,	O
like	O
image	B-Algorithm
,	O
video	O
,	O
and	O
digital	B-General_Concept
signal	I-General_Concept
processing	I-General_Concept
;	O
or	O
when	O
their	O
use	O
is	O
more	O
natural	O
for	O
the	O
problem	O
.	O
</s>
<s>
Examples	O
of	O
the	O
latter	O
are	O
accounting	O
of	O
dollar	O
amounts	O
,	O
when	O
fractions	O
of	O
cents	O
must	O
be	O
rounded	B-Algorithm
to	O
whole	O
cents	O
in	O
strictly	O
prescribed	O
ways	O
;	O
and	O
the	O
evaluation	O
of	O
functions	O
by	O
table	B-Data_Structure
lookup	I-Data_Structure
.	O
</s>
<s>
For	O
example	O
,	O
the	O
value	O
1.23	O
can	O
be	O
stored	O
in	O
a	O
variable	O
as	O
the	O
integer	O
value	O
1230	O
with	O
implicit	O
scaling	O
factor	O
of	O
1/1000	O
(	O
meaning	O
that	O
the	O
last	O
3	O
decimal	B-Application
digits	O
are	O
implicitly	O
assumed	O
to	O
be	O
a	O
decimal	B-Application
fraction	O
)	O
,	O
and	O
the	O
value	O
can	O
be	O
represented	O
as	O
1230	O
with	O
an	O
implicit	O
scaling	O
factor	O
of	O
1000	O
(	O
with	O
"	O
minus	O
3	O
"	O
implied	O
decimal	B-Application
fraction	O
digits	O
,	O
that	O
is	O
,	O
with	O
3	O
implicit	O
zero	O
digits	O
at	O
right	O
)	O
.	O
</s>
<s>
This	O
representation	O
allows	O
standard	O
integer	O
arithmetic	B-General_Concept
units	I-General_Concept
to	O
perform	O
rational	O
number	O
calculations	O
.	O
</s>
<s>
Negative	O
values	O
are	O
usually	O
represented	O
in	O
binary	O
fixed-point	O
format	O
as	O
a	O
signed	O
integer	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
representation	O
with	O
an	O
implicit	O
scaling	O
factor	O
as	O
above	O
.	O
</s>
<s>
The	O
sign	O
of	O
the	O
value	O
will	O
always	O
be	O
indicated	O
by	O
the	O
first	B-Language
stored	I-Language
bit	I-Language
(	O
1	O
=	O
negative	O
,	O
0	O
=	O
non-negative	O
)	O
,	O
even	O
if	O
the	O
number	O
of	O
fraction	O
bits	O
is	O
greater	O
than	O
or	O
equal	O
to	O
the	O
total	O
number	O
of	O
bits	O
.	O
</s>
<s>
This	O
variant	O
is	O
more	O
commonly	O
used	O
in	O
decimal	B-Application
fixed-point	O
arithmetic	O
.	O
</s>
<s>
Thus	O
the	O
signed	O
5-digit	O
decimal	B-Application
integer	O
( −00025	O
)	O
10	O
,	O
taken	O
with	O
-3	O
,	O
+5	O
,	O
and	O
+12	O
implied	O
decimal	B-Application
fraction	O
digits	O
,	O
would	O
represent	O
the	O
values	O
−	O
25/10	O
−3	O
=	O
−25000	O
,	O
−	O
25/105	O
=	O
−	O
0.00025	O
,	O
and	O
−	O
25/1012	O
=	O
−	O
0.	O
,	O
respectively	O
.	O
</s>
<s>
A	O
program	O
will	O
usually	O
assume	O
that	O
all	O
fixed-point	O
values	O
that	O
will	O
be	O
stored	O
into	O
a	O
given	O
variable	O
,	O
or	O
will	O
be	O
produced	O
by	O
a	O
given	O
instruction	B-General_Concept
,	O
will	O
have	O
the	O
same	O
scaling	O
factor	O
.	O
</s>
<s>
Good	B-General_Concept
programming	I-General_Concept
practice	I-General_Concept
then	O
requires	O
that	O
it	O
be	O
provided	O
in	O
the	O
documentation	O
,	O
at	O
least	O
as	O
a	O
comment	O
in	O
the	O
source	O
code	O
.	O
</s>
<s>
Decimal	B-Application
scaling	O
factors	O
also	O
mesh	O
well	O
with	O
the	O
metric	O
(	O
SI	O
)	O
system	O
,	O
since	O
the	O
choice	O
of	O
the	O
fixed-point	O
scaling	O
factor	O
is	O
often	O
equivalent	O
to	O
the	O
choice	O
of	O
a	O
unit	O
of	O
measure	O
(	O
like	O
centimetres	O
or	O
microns	O
instead	O
of	O
metres	O
)	O
.	O
</s>
<s>
Even	O
with	O
the	O
most	O
careful	O
rounding	B-Algorithm
,	O
fixed-point	O
values	O
represented	O
with	O
a	O
scaling	O
factor	O
S	O
may	O
have	O
an	O
error	O
of	O
up	O
to	O
±	O
0.5	O
in	O
the	O
stored	O
integer	O
,	O
that	O
is	O
,	O
±	O
0.5	O
S	O
in	O
the	O
value	O
.	O
</s>
<s>
have	O
been	O
said	O
to	O
be	O
appropriate	O
for	O
image	B-Algorithm
processing	I-Algorithm
and	O
other	O
digital	B-General_Concept
signal	I-General_Concept
processing	I-General_Concept
tasks	O
.	O
</s>
<s>
They	O
are	O
supposed	O
to	O
provide	O
more	O
consistent	O
conversions	O
between	O
fixed	O
-	O
and	O
floating-point	B-Algorithm
values	O
than	O
the	O
usual	O
2n	O
scaling	O
.	O
</s>
<s>
The	O
Julia	B-Application
programming	I-Application
language	I-Application
implements	O
both	O
versions	O
.	O
</s>
<s>
Any	O
binary	O
fraction	O
a/2m	O
,	O
such	O
as	O
1/16	O
or	O
17/32	O
,	O
can	O
be	O
exactly	O
represented	O
in	O
fixed-point	O
,	O
with	O
a	O
power-of-two	O
scaling	O
factor	O
1/2n	O
with	O
any	O
n	O
≥	O
m	O
.	O
However	O
,	O
most	O
decimal	B-Application
fractions	O
like	O
0.1	O
or	O
0.123	O
are	O
infinite	O
repeating	O
fractions	O
in	O
base	O
2	O
.	O
and	O
hence	O
cannot	O
be	O
represented	O
that	O
way	O
.	O
</s>
<s>
Similarly	O
,	O
any	O
decimal	B-Application
fraction	O
a/10m	O
,	O
such	O
as	O
1/100	O
or	O
37/1000	O
,	O
can	O
be	O
exactly	O
represented	O
in	O
fixed	O
point	O
with	O
a	O
power-of-ten	O
scaling	O
factor	O
1/10n	O
with	O
any	O
n	O
≥	O
m	O
.	O
This	O
decimal	B-Application
format	O
can	O
also	O
represent	O
any	O
binary	O
fraction	O
a/2m	O
,	O
such	O
as	O
1/8	O
(	O
0.125	O
)	O
or	O
17/32	O
(	O
0.53125	O
)	O
.	O
</s>
<s>
More	O
generally	O
,	O
a	O
rational	O
number	O
a/b	O
,	O
with	O
a	O
and	O
b	O
relatively	O
prime	O
and	O
b	O
positive	O
,	O
can	O
be	O
exactly	O
represented	O
in	O
binary	O
fixed	O
point	O
only	O
if	O
b	O
is	O
a	O
power	O
of	O
2	O
;	O
and	O
in	O
decimal	B-Application
fixed	O
point	O
only	O
if	O
b	O
has	O
no	O
prime	O
factors	O
other	O
than	O
2	O
and/or	O
5	O
.	O
</s>
<s>
Fixed-point	O
computations	O
can	O
be	O
faster	O
and/or	O
use	O
less	O
hardware	O
than	O
floating-point	B-Algorithm
ones	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
32	O
bits	O
are	O
available	O
to	O
represent	O
a	O
number	O
between	O
0	O
and	O
1	O
,	O
a	O
fixed-point	O
representation	O
can	O
have	O
error	O
less	O
than	O
1.2	O
×	O
10−10	O
,	O
whereas	O
the	O
standard	O
floating-point	B-Algorithm
representation	I-Algorithm
may	O
have	O
error	O
up	O
to	O
596	O
×	O
10−10	O
—	O
because	O
9	O
of	O
the	O
bits	O
are	O
wasted	O
with	O
the	O
sign	O
and	O
exponent	O
of	O
the	O
dynamic	O
scaling	O
factor	O
.	O
</s>
<s>
Specifically	O
,	O
comparing	O
32-bit	O
fixed-point	O
to	O
floating-point	B-Algorithm
audio	O
,	O
a	O
recording	O
requiring	O
less	O
than	O
40	O
dB	O
of	O
headroom	O
has	O
a	O
higher	O
signal-to-noise	O
ratio	O
using	O
32-bit	O
fixed	O
.	O
</s>
<s>
Programs	O
using	O
fixed-point	O
computations	O
are	O
usually	O
more	O
portable	O
than	O
those	O
using	O
floating-point	B-Algorithm
,	O
since	O
they	O
do	O
n't	O
depend	O
on	O
the	O
availability	O
of	O
an	O
FPU	O
.	O
</s>
<s>
This	O
advantage	O
was	O
particularly	O
strong	O
before	O
the	O
IEEE	O
Floating	B-Algorithm
Point	I-Algorithm
Standard	O
was	O
widely	O
adopted	O
,	O
when	O
floating-point	B-Algorithm
computations	O
with	O
the	O
same	O
data	O
would	O
yield	O
different	O
results	O
depending	O
on	O
the	O
manufacturer	O
,	O
and	O
often	O
on	O
the	O
computer	O
model	O
.	O
</s>
<s>
Many	O
embedded	B-Architecture
processors	I-Architecture
lack	O
an	O
FPU	O
,	O
because	O
integer	O
arithmetic	B-General_Concept
units	I-General_Concept
require	O
substantially	O
fewer	O
logic	O
gates	O
and	O
consume	O
much	O
smaller	O
chip	O
area	O
than	O
an	O
FPU	O
;	O
and	O
software	B-Application
emulation	I-Application
of	O
floating-point	B-Algorithm
on	O
low-speed	O
devices	O
would	O
be	O
too	O
slow	O
for	O
most	O
applications	O
.	O
</s>
<s>
CPU	B-Architecture
chips	I-Architecture
for	O
the	O
earlier	O
personal	B-Device
computers	I-Device
and	O
game	O
consoles	O
,	O
like	O
the	O
Intel	B-General_Concept
386	I-General_Concept
and	O
486SX	B-Device
,	O
also	O
lacked	O
an	O
FPU	O
.	O
</s>
<s>
The	O
absolute	O
resolution	O
(	O
difference	O
between	O
successive	O
values	O
)	O
of	O
any	O
fixed-point	O
format	O
is	O
constant	O
over	O
the	O
whole	O
range	O
,	O
namely	O
the	O
scaling	O
factor	O
S	O
.	O
In	O
contrast	O
,	O
the	O
relative	O
resolution	O
of	O
a	O
floating-point	B-Algorithm
format	I-Algorithm
is	O
approximately	O
constant	O
over	O
their	O
whole	O
range	O
,	O
varying	O
within	O
a	O
factor	O
of	O
the	O
base	O
b	O
;	O
whereas	O
their	O
absolute	O
resolution	O
varies	O
by	O
many	O
orders	O
of	O
magnitude	O
,	O
like	O
the	O
values	O
themselves	O
.	O
</s>
<s>
In	O
many	O
cases	O
,	O
the	O
rounding	B-Algorithm
and	I-Algorithm
truncation	I-Algorithm
errors	O
of	O
fixed-point	O
computations	O
are	O
easier	O
to	O
analyze	O
than	O
those	O
of	O
the	O
equivalent	O
floating-point	B-Algorithm
computations	O
.	O
</s>
<s>
Avoidance	O
of	O
overflow	B-Algorithm
requires	O
much	O
tighter	O
estimates	O
for	O
the	O
ranges	O
of	O
variables	O
and	O
all	O
intermediate	O
values	O
in	O
the	O
computation	O
,	O
and	O
often	O
also	O
extra	O
code	O
to	O
adjust	O
their	O
scaling	O
factors	O
.	O
</s>
<s>
Fixed-point	O
applications	O
can	O
make	O
use	O
of	O
block	B-Algorithm
floating	I-Algorithm
point	I-Algorithm
,	O
which	O
is	O
a	O
fixed-point	O
environment	O
having	O
each	O
array	O
(	O
block	O
)	O
of	O
fixed-point	O
data	O
be	O
scaled	O
with	O
a	O
common	O
exponent	O
in	O
a	O
single	O
word	O
.	O
</s>
<s>
A	O
common	O
use	O
of	O
decimal	B-Application
fixed-point	O
is	O
for	O
storing	O
monetary	O
values	O
,	O
for	O
which	O
the	O
complicated	O
rounding	B-Algorithm
rules	O
of	O
floating-point	B-Algorithm
numbers	I-Algorithm
are	O
often	O
a	O
liability	O
.	O
</s>
<s>
For	O
example	O
,	O
the	O
open	O
source	O
money	O
management	O
application	O
GnuCash	B-Language
,	O
written	O
in	O
C	B-Language
,	O
switched	O
from	O
floating-point	B-Algorithm
to	O
fixed-point	O
as	O
of	O
version	O
1.6	O
,	O
for	O
this	O
reason	O
.	O
</s>
<s>
Binary	O
fixed-point	O
(	O
binary	O
scaling	O
)	O
was	O
widely	O
used	O
from	O
the	O
late	O
1960s	O
to	O
the	O
1980s	O
for	O
real-time	O
computing	O
that	O
was	O
mathematically	O
intensive	O
,	O
such	O
as	O
flight	B-Application
simulation	I-Application
and	O
in	O
nuclear	O
power	O
plant	O
control	O
algorithms	O
.	O
</s>
<s>
It	O
is	O
still	O
used	O
in	O
many	O
DSP	B-General_Concept
applications	O
and	O
custom	O
made	O
microprocessors	B-Architecture
.	O
</s>
<s>
Binary	O
fixed	O
point	O
is	O
used	O
in	O
the	O
STM32G4	O
series	O
CORDIC	B-Algorithm
co-processors	O
and	O
in	O
the	O
discrete	B-General_Concept
cosine	I-General_Concept
transform	I-General_Concept
(	O
DCT	B-General_Concept
)	O
algorithms	O
used	O
to	O
compress	O
JPEG	O
images	O
.	O
</s>
<s>
Binary	O
fixed	O
point	O
polynomials	O
can	O
utilize	O
more	O
bits	O
of	O
precision	O
than	O
floating-point	B-Algorithm
,	O
and	O
do	O
so	O
in	O
fast	O
code	O
using	O
inexpensive	O
CPUs	O
.	O
</s>
<s>
Accuracy	O
,	O
crucial	O
for	O
instruments	O
,	O
compares	O
well	O
to	O
equivalent-bit	O
floating-point	B-Algorithm
calculations	O
,	O
if	O
the	O
fixed-point	O
polynomials	O
are	O
factored	O
(	O
e.g.	O
</s>
<s>
y	O
=	O
d	O
+	O
x( c	O
+	O
x( b	O
+	O
xa	O
)	O
)	O
)	O
to	O
reduce	O
the	O
number	O
of	O
times	O
that	O
rounding	B-Algorithm
occurs	O
,	O
and	O
the	O
fixed-point	O
multiplications	O
utilize	O
rounding	B-Algorithm
addends	O
.	O
</s>
<s>
These	O
operations	O
yield	O
the	O
exact	O
mathematical	O
result	O
,	O
as	O
long	O
as	O
no	O
overflow	B-Algorithm
occurs	O
—	O
that	O
is	O
,	O
as	O
long	O
as	O
the	O
resulting	O
integer	O
can	O
be	O
stored	O
in	O
the	O
receiving	O
program	O
variable	O
.	O
</s>
<s>
The	O
result	O
will	O
be	O
exact	O
,	O
with	O
no	O
rounding	B-Algorithm
,	O
provided	O
that	O
it	O
does	O
not	O
overflow	B-Algorithm
the	O
receiving	O
variable	O
.	O
</s>
<s>
Rounding	B-Algorithm
is	O
possible	O
by	O
adding	O
a	O
'	O
rounding	B-Algorithm
addend	O
 '	O
of	O
half	O
of	O
the	O
scaling	O
factor	O
before	O
shifting	O
;	O
The	O
proof	O
:	O
round( 	O
x/y	O
)	O
=	O
floor( 	O
x/y	O
+	O
0.5	O
)	O
=	O
floor( ( x	O
+	O
y/2	O
)	O
/y	O
)	O
=	O
shift-of-n	O
( x	O
+	O
2^( 	O
n-1	O
)	O
)	O
A	O
similar	O
method	O
is	O
usable	O
in	O
any	O
scaling	O
.	O
</s>
<s>
In	O
general	O
,	O
the	O
first	O
division	O
requires	O
rounding	B-Algorithm
and	O
therefore	O
the	O
result	O
is	O
not	O
exact	O
.	O
</s>
<s>
For	O
example	O
,	O
division	O
of	O
3456	O
scaled	O
by	O
1/100	O
(	O
34.56	O
)	O
and	O
1234	O
scaled	O
by	O
1/1000	O
(	O
1.234	O
)	O
yields	O
the	O
integer	O
3456÷1234	O
=	O
3	O
(	O
rounded	B-Algorithm
)	O
with	O
scale	O
factor	O
(	O
1/100	O
)	O
/	O
(	O
1/1000	O
)	O
=	O
10	O
,	O
that	O
is	O
,	O
30	O
.	O
</s>
<s>
As	O
another	O
example	O
,	O
the	O
division	O
of	O
the	O
first	O
number	O
by	O
155	O
implicitly	O
scaled	O
by	O
1/32	O
(	O
155/32	O
=	O
4.84375	O
)	O
yields	O
the	O
integer	O
3456÷155	O
=	O
22	O
(	O
rounded	B-Algorithm
)	O
with	O
implicit	O
scaling	O
factor	O
(	O
1/100	O
)	O
/	O
(	O
1/32	O
)	O
=	O
32/100	O
=	O
8/25	O
,	O
that	O
is	O
22×	O
32/100	O
=	O
7.04	O
.	O
</s>
<s>
If	O
the	O
result	O
is	O
not	O
exact	O
,	O
the	O
error	O
introduced	O
by	O
the	O
rounding	B-Algorithm
can	O
be	O
reduced	O
or	O
even	O
eliminated	O
by	O
converting	O
the	O
dividend	O
to	O
a	O
smaller	O
scaling	O
factor	O
.	O
</s>
<s>
For	O
example	O
,	O
if	O
r	O
=	O
1.23	O
is	O
represented	O
as	O
123	O
with	O
scaling	O
1/100	O
,	O
and	O
s	O
=	O
6.25	O
is	O
represented	O
as	O
6250	O
with	O
scaling	O
1/1000	O
,	O
then	O
simple	O
division	O
of	O
the	O
integers	O
yields	O
123÷6250	O
=	O
0	O
(	O
rounded	B-Algorithm
)	O
with	O
scaling	O
factor	O
(	O
1/100	O
)	O
/	O
(	O
1/1000	O
)	O
=	O
10	O
.	O
</s>
<s>
If	O
r	O
is	O
first	O
converted	O
to	O
1,230,000	O
with	O
scaling	O
factor	O
1/1000000	O
,	O
the	O
result	O
will	O
be	O
1,230,000	O
÷6250	O
=	O
197	O
(	O
rounded	B-Algorithm
)	O
with	O
scale	O
factor	O
1/1000	O
(	O
0.197	O
)	O
.	O
</s>
<s>
To	O
ensure	O
that	O
the	O
result	O
of	O
an	O
operation	O
can	O
be	O
stored	O
into	O
a	O
program	O
variable	O
without	O
overflow	B-Algorithm
;	O
</s>
<s>
In	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
representation	O
,	O
that	O
means	O
extending	O
the	O
sign	O
bit	O
as	O
in	O
arithmetic	O
shift	O
operations	O
.	O
</s>
<s>
If	O
S	O
does	O
not	O
divide	O
R	O
(	O
in	O
particular	O
,	O
if	O
the	O
new	O
scaling	O
factor	O
S	O
is	O
greater	O
than	O
the	O
original	O
R	O
)	O
,	O
the	O
new	O
integer	O
may	O
have	O
to	O
be	O
rounded	B-Algorithm
.	O
</s>
<s>
In	O
particular	O
,	O
if	O
r	O
and	O
s	O
are	O
fixed-point	O
variables	O
with	O
implicit	O
scaling	O
factors	O
R	O
and	O
S	O
,	O
the	O
operation	O
r	O
←	O
r×s	O
require	O
multiplying	O
the	O
respective	O
integers	O
and	O
explicitly	O
dividing	O
the	O
result	O
by	O
S	O
.	O
The	O
result	O
may	O
have	O
to	O
be	O
rounded	B-Algorithm
,	O
and	O
overflow	B-Algorithm
may	O
occur	O
.	O
</s>
<s>
In	O
order	O
to	O
return	O
to	O
the	O
original	O
scaling	O
factor	O
1/100	O
,	O
the	O
integer	O
3075	O
then	O
must	O
be	O
multiplied	O
by	O
1/100	O
,	O
that	O
is	O
,	O
divided	O
by	O
100	O
,	O
to	O
yield	O
either	O
31	O
(	O
0.31	O
)	O
or	O
30	O
(	O
0.30	O
)	O
,	O
depending	O
on	O
the	O
rounding	B-Algorithm
policy	I-Algorithm
used	O
.	O
</s>
<s>
Similarly	O
,	O
the	O
operation	O
r	O
←	O
r/s	O
will	O
require	O
dividing	O
the	O
integers	O
and	O
explicitly	O
multiplying	O
the	O
quotient	O
by	O
S	O
.	O
Rounding	B-Algorithm
and/or	O
overflow	B-Algorithm
may	O
occur	O
here	O
too	O
.	O
</s>
<s>
To	O
convert	O
a	O
number	O
from	O
floating	B-Algorithm
point	I-Algorithm
to	O
fixed	O
point	O
,	O
one	O
may	O
multiply	O
it	O
by	O
the	O
scaling	O
factor	O
S	O
,	O
then	O
round	O
the	O
result	O
to	O
the	O
nearest	B-Algorithm
integer	I-Algorithm
.	O
</s>
<s>
Care	O
must	O
be	O
taken	O
to	O
ensure	O
that	O
the	O
result	O
fits	O
in	O
the	O
destination	O
variable	O
or	O
register	B-General_Concept
.	O
</s>
<s>
Depending	O
on	O
the	O
scaling	O
factor	O
and	O
storage	O
size	O
,	O
and	O
on	O
the	O
range	O
input	O
numbers	O
,	O
the	O
conversion	O
may	O
not	O
entail	O
any	O
rounding	B-Algorithm
.	O
</s>
<s>
To	O
convert	O
a	O
fixed-point	O
number	O
to	O
floating-point	B-Algorithm
,	O
one	O
may	O
convert	O
the	O
integer	O
to	O
floating-point	B-Algorithm
and	O
then	O
divide	O
it	O
by	O
the	O
scaling	O
factor	O
S	O
.	O
This	O
conversion	O
may	O
entail	O
rounding	B-Algorithm
if	O
the	O
integer	O
's	O
absolute	O
value	O
is	O
greater	O
than	O
224	O
(	O
for	O
binary	O
single-precision	O
IEEE	O
floating	B-Algorithm
point	I-Algorithm
)	O
or	O
of	O
253	O
(	O
for	O
double-precision	O
)	O
.	O
</s>
<s>
Overflow	B-Algorithm
or	O
underflow	B-Algorithm
may	O
occur	O
if	O
|S|	O
is	O
very	O
large	O
or	O
very	O
small	O
,	O
respectively	O
.	O
</s>
<s>
Typical	O
processors	B-General_Concept
do	O
not	O
have	O
specific	O
support	O
for	O
fixed-point	O
arithmetic	O
.	O
</s>
<s>
However	O
,	O
most	O
computers	O
with	O
binary	O
arithmetic	O
have	O
fast	O
bit	O
shift	O
instructions	O
that	O
can	O
multiply	O
or	O
divide	O
an	O
integer	O
by	O
any	O
power	O
of	O
2	O
;	O
in	O
particular	O
,	O
an	O
arithmetic	O
shift	O
instruction	B-General_Concept
.	O
</s>
<s>
Early	O
computers	O
like	O
the	O
IBM	B-Device
1620	I-Device
and	O
the	O
Burroughs	B-Language
B3500	I-Language
used	O
a	O
binary-coded	O
decimal	B-Application
(	O
BCD	O
)	O
representation	O
for	O
integers	O
,	O
namely	O
base	O
10	O
where	O
each	O
decimal	B-Application
digit	O
was	O
independently	O
encoded	O
with	O
4	O
bits	O
.	O
</s>
<s>
Some	O
processors	B-General_Concept
,	O
such	O
as	O
microcontrollers	B-Architecture
,	O
may	O
still	O
use	O
it	O
.	O
</s>
<s>
In	O
such	O
machines	O
,	O
conversion	O
of	O
decimal	B-Application
scaling	O
factors	O
can	O
be	O
performed	O
by	O
bit	O
shifts	O
and/or	O
by	O
memory	O
address	O
manipulation	O
.	O
</s>
<s>
Some	O
DSP	B-General_Concept
architectures	O
offer	O
native	O
support	O
for	O
specific	O
fixed-point	O
formats	O
,	O
for	O
example	O
signed	O
n-bit	O
numbers	O
with	O
n−1	O
fraction	O
bits	O
(	O
whose	O
values	O
may	O
range	O
between	O
−1	O
and	O
almost	O
+1	O
)	O
.	O
</s>
<s>
The	O
support	O
may	O
include	O
a	O
multiply	O
instruction	B-General_Concept
that	O
includes	O
renormalization	O
—	O
the	O
scaling	O
conversion	O
of	O
the	O
product	O
from	O
2n−2	O
to	O
n−1	O
fraction	O
bits	O
.	O
</s>
<s>
If	O
the	O
CPU	O
does	O
not	O
provide	O
that	O
feature	O
,	O
the	O
programmer	O
must	O
save	O
the	O
product	O
in	O
a	O
large	O
enough	O
register	B-General_Concept
or	O
temporary	O
variable	O
,	O
and	O
code	O
the	O
renormalization	O
explicitly	O
.	O
</s>
<s>
Overflow	B-Algorithm
happens	O
when	O
the	O
result	O
of	O
an	O
arithmetic	O
operation	O
is	O
too	O
large	O
to	O
be	O
stored	O
in	O
the	O
designated	O
destination	O
area	O
.	O
</s>
<s>
In	O
case	O
of	O
overflow	B-Algorithm
,	O
the	O
high-order	O
bits	O
are	O
usually	O
lost	O
,	O
as	O
the	O
un-scaled	O
integer	O
gets	O
reduced	O
modulo	O
2n	O
where	O
n	O
is	O
the	O
size	O
of	O
the	O
storage	O
area	O
.	O
</s>
<s>
Some	O
processors	B-General_Concept
can	O
set	O
a	O
hardware	O
overflow	B-Algorithm
flag	I-Algorithm
and/or	O
generate	O
an	O
exception	B-General_Concept
on	O
the	O
occurrence	O
of	O
an	O
overflow	B-Algorithm
.	O
</s>
<s>
Some	O
processors	B-General_Concept
may	O
instead	O
provide	O
saturation	B-Algorithm
arithmetic	I-Algorithm
:	O
if	O
the	O
result	O
of	O
an	O
addition	O
or	O
subtraction	O
were	O
to	O
overflow	B-Algorithm
,	O
they	O
store	O
instead	O
the	O
value	O
with	O
largest	O
magnitude	O
that	O
can	O
fit	O
in	O
the	O
receiving	O
area	O
and	O
has	O
the	O
correct	O
sign	O
.	O
</s>
<s>
However	O
,	O
these	O
features	O
are	O
not	O
very	O
useful	O
in	O
practice	O
;	O
it	O
is	O
generally	O
easier	O
and	O
safer	O
to	O
select	O
scaling	O
factors	O
and	O
word	O
sizes	O
so	O
as	O
to	O
exclude	O
the	O
possibility	O
of	O
overflow	B-Algorithm
,	O
or	O
to	O
check	O
the	O
operands	O
for	O
excessive	O
values	O
before	O
executing	O
the	O
operation	O
.	O
</s>
<s>
Explicit	O
support	O
for	O
fixed-point	O
numbers	O
is	O
provided	O
by	O
a	O
few	O
computer	O
languages	O
,	O
notably	O
PL/I	B-Language
,	O
COBOL	B-Application
,	O
Ada	B-Language
,	O
JOVIAL	B-Language
,	O
and	O
Coral	B-Language
66	I-Language
.	O
</s>
<s>
They	O
provide	O
fixed-point	O
data	O
types	O
,	O
with	O
a	O
binary	O
or	O
decimal	B-Application
scaling	O
factor	O
.	O
</s>
<s>
The	O
compiler	O
automatically	O
generates	O
code	O
to	O
do	O
the	O
appropriate	O
scaling	O
conversions	O
when	O
doing	O
operations	O
on	O
these	O
data-types	O
,	O
when	O
reading	O
or	O
writing	O
variables	O
,	O
or	O
when	O
converting	O
the	O
values	O
to	O
other	O
data	O
types	O
such	O
as	O
floating-point	B-Algorithm
.	O
</s>
<s>
That	O
is	O
also	O
the	O
case	O
for	O
several	O
older	O
languages	O
that	O
are	O
still	O
very	O
popular	O
,	O
like	O
FORTRAN	B-Application
,	O
C	B-Language
and	O
C++	B-Language
.	O
</s>
<s>
The	O
wide	O
availability	O
of	O
fast	O
floating-point	B-General_Concept
processors	I-General_Concept
,	O
with	O
strictly	O
standardized	O
behavior	O
,	O
have	O
greatly	O
reduced	O
the	O
demand	O
for	O
binary	O
fixed	O
point	O
support	O
.	O
</s>
<s>
Similarly	O
,	O
the	O
support	O
for	O
decimal	B-Application
floating	B-Algorithm
point	I-Algorithm
in	O
some	O
programming	O
languages	O
,	O
like	O
C#	B-Application
and	O
Python	B-Language
,	O
has	O
removed	O
most	O
of	O
the	O
need	O
for	O
decimal	B-Application
fixed-point	O
support	O
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
all	O
relational	O
databases	O
and	O
the	O
SQL	B-Language
notation	O
support	O
fixed-point	O
decimal	B-Application
arithmetic	O
and	O
storage	O
of	O
numbers	O
.	O
</s>
<s>
PostgreSQL	B-Application
has	O
a	O
special	O
numeric	B-Algorithm
type	O
for	O
exact	O
storage	O
of	O
numbers	O
with	O
up	O
to	O
1000	O
digits	O
.	O
</s>
<s>
Moreover	O
,	O
in	O
2008	O
the	O
International	O
Standards	O
Organization	O
(	O
ISO	O
)	O
issued	O
a	O
proposal	O
to	O
extend	O
the	O
C	B-Language
programming	I-Language
language	I-Language
with	O
fixed-point	O
data	O
types	O
,	O
for	O
the	O
benefit	O
of	O
programs	O
running	O
on	O
embedded	B-Architecture
processors	I-Architecture
.	O
</s>
<s>
Also	O
,	O
the	O
GNU	B-Application
Compiler	I-Application
Collection	I-Application
(	O
GCC	B-Application
)	O
has	O
back-end	O
support	O
for	O
fixed-point	O
.	O
</s>
<s>
Suppose	O
there	O
is	O
the	O
following	O
multiplication	O
with	O
2	O
fixed	O
point	O
3	O
decimal	B-Application
place	O
numbers	O
.	O
</s>
<s>
Note	O
how	O
since	O
there	O
are	O
3	O
decimal	B-Application
places	O
we	O
show	O
the	O
trailing	O
zeros	O
.	O
</s>
<s>
Three	O
decimal	B-Application
digits	O
is	O
equivalent	O
to	O
about	O
10	O
binary	O
digits	O
,	O
so	O
we	O
should	O
round	O
0.05	O
to	O
10	O
bits	O
after	O
the	O
binary	O
point	O
.	O
</s>
<s>
This	O
rounds	O
to	O
11.023	O
with	O
three	O
digits	O
after	O
the	O
decimal	B-Application
point	O
.	O
</s>
<s>
To	O
represent	O
the	O
two	O
numbers	O
,	O
one	O
multiplies	O
them	O
by	O
216	O
,	O
obtaining	O
.2	O
and	O
.6	O
;	O
and	O
round	O
these	O
values	O
the	O
nearest	B-Algorithm
integers	I-Algorithm
,	O
obtaining	O
and	O
.	O
</s>
<s>
These	O
numbers	O
will	O
fit	O
comfortably	O
into	O
a	O
32-bit	O
word	O
with	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
signed	O
format	O
.	O
</s>
<s>
Multiplying	O
these	O
integers	O
together	O
gives	O
the	O
35-bit	O
integer	O
with	O
32	O
fraction	O
bits	O
,	O
without	O
any	O
rounding	B-Algorithm
.	O
</s>
<s>
Note	O
that	O
storing	O
this	O
value	O
directly	O
into	O
a	O
32-bit	O
integer	O
variable	O
would	O
result	O
in	O
overflow	B-Algorithm
and	O
loss	O
of	O
the	O
most	O
significant	B-Language
bits	I-Language
.	O
</s>
<s>
In	O
practice	O
,	O
it	O
would	O
probably	O
be	O
stored	O
in	O
a	O
signed	O
64-bit	O
integer	O
variable	O
or	O
register	B-General_Concept
.	O
</s>
<s>
If	O
the	O
result	O
is	O
to	O
be	O
stored	O
in	O
the	O
same	O
format	O
as	O
the	O
data	O
,	O
with	O
16	O
fraction	O
bits	O
,	O
that	O
integer	O
should	O
be	O
divided	O
by	O
216	O
,	O
which	O
gives	O
approximately	O
.28	O
,	O
and	O
then	O
rounded	B-Algorithm
to	O
the	O
nearest	B-Algorithm
integer	I-Algorithm
.	O
</s>
<s>
The	O
COBOL	B-Application
programming	I-Application
language	I-Application
originally	O
supported	O
decimal	B-Application
fixed-precision	O
with	O
arbitrary	O
size	O
and	O
decimal	B-Application
scaling	O
,	O
whose	O
format	O
was	O
specified	O
"	O
graphically	O
"	O
with	O
the	O
directive	O
.	O
</s>
<s>
For	O
example	O
,	O
specified	O
a	O
sign-magnitude	O
6-digit	O
decimal	B-Application
integer	O
with	O
two	O
decimal	B-Application
fraction	O
digits	O
.	O
</s>
<s>
The	O
construct	O
pf	O
is	O
used	O
in	O
the	O
PL/I	B-Language
programming	I-Language
language	I-Language
,	O
to	O
specify	O
a	O
fixed-point	O
signed	O
binary	O
data	O
type	O
with	O
p	O
total	O
bits	O
(	O
not	O
including	O
sign	O
)	O
with	O
f	O
bits	O
in	O
the	O
fraction	O
part	O
;	O
that	O
is	O
a	O
p+1	O
bit	O
signed	O
integer	O
with	O
a	O
scaling	O
factor	O
of	O
1/2f	O
.	O
</s>
<s>
In	O
the	O
Ada	B-Language
programming	I-Language
language	I-Language
,	O
a	O
numeric	B-Algorithm
data	O
type	O
can	O
be	O
specified	O
by	O
,	O
for	O
example	O
,,	O
meaning	O
a	O
fixed-point	O
representation	O
consisting	O
of	O
a	O
signed	O
binary	O
integer	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
format	O
with	O
7	O
implied	O
fraction	O
bits	O
(	O
providin	O
a	O
scaling	O
factor	O
1/128	O
)	O
and	O
at	O
least	O
15	O
bits	O
total	O
(	O
ensuring	O
an	O
actual	O
range	O
from	O
-128.00	O
to	O
almost	O
+	O
128.00	O
)	O
.	O
</s>
<s>
The	O
Q	B-Algorithm
notation	I-Algorithm
was	O
defined	O
by	O
Texas	O
Instruments	O
.	O
</s>
<s>
One	O
writes	O
f	O
to	O
specify	O
a	O
signed	O
binary	O
fixed-point	O
value	O
with	O
f	O
fraction	O
bits	O
;	O
for	O
example	O
,	O
specifies	O
a	O
signed	O
integer	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
notation	I-General_Concept
with	O
a	O
scaling	O
factor	O
1/215	O
.	O
</s>
<s>
Thus	O
would	O
describe	O
a	O
binary	O
fixed-point	O
format	O
with	O
1	O
integer	O
bit	O
and	O
30	O
fractional	O
bits	O
,	O
which	O
could	O
be	O
stored	O
as	O
a	O
32-bit	O
2	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
integer	O
with	O
scaling	O
factor	O
1/230	O
.	O
</s>
<s>
A	O
similar	O
notation	O
has	O
been	O
used	O
by	O
ARM	B-Architecture
,	O
except	O
that	O
they	O
count	O
the	O
sign	O
bit	O
in	O
the	O
value	O
of	O
m	O
;	O
so	O
the	O
same	O
format	O
above	O
would	O
be	O
specified	O
as	O
.	O
</s>
<s>
The	O
VisSim	B-Application
company	O
used	O
mb	O
to	O
denote	O
a	O
binary	O
fixed-point	O
value	O
with	O
b	O
total	O
bits	O
and	O
m	O
bits	O
in	O
the	O
integer	O
part	O
;	O
that	O
is	O
,	O
a	O
b-bit	O
integer	O
with	O
scaling	O
factor	O
1/2b	O
−m	O
.	O
</s>
<s>
The	O
PS2	B-Device
GS	O
(	O
"	O
Graphics	O
Synthesizer	O
"	O
)	O
User	O
's	O
Guide	O
uses	O
the	O
notation	O
smf	O
,	O
where	O
s	O
specifies	O
the	O
presence	O
(	O
0	O
or	O
1	O
)	O
of	O
sign	O
bit	O
.	O
</s>
<s>
The	O
LabVIEW	B-Application
programming	O
language	O
uses	O
the	O
notation	O
sbm	O
to	O
specify	O
the	O
parameters	O
of	O
an	O
'	O
FXP	O
 '	O
fixed	O
point	O
numbers	O
.	O
</s>
<s>
The	O
s	O
component	O
can	O
be	O
either	O
'	O
+	O
 '	O
or	O
'	O
±	O
 '	O
,	O
signifying	O
either	O
an	O
unsigned	O
or	O
2	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
signed	O
number	O
,	O
respectively	O
.	O
</s>
<s>
The	O
popular	O
TrueType	O
font	O
format	O
uses	O
32-bit	O
signed	O
binary	O
fixed-point	O
with	O
26	O
bits	O
to	O
the	O
left	O
of	O
the	O
decimal	B-Application
for	O
some	O
numeric	B-Algorithm
values	O
in	O
its	O
instructions	O
.	O
</s>
<s>
All	O
3D	O
games	O
for	O
the	O
fifth	B-Application
generation	I-Application
of	I-Application
video	I-Application
game	I-Application
consoles	I-Application
,	O
including	O
the	O
3DO	B-Device
Interactive	I-Device
Multiplayer	I-Device
,	O
PlayStation	B-Device
,	O
Saturn	B-Device
,	O
and	O
Jaguar	B-Device
,	O
plus	O
the	O
sixth	O
generation	O
GameCube	B-Application
,	O
use	O
fixed-point	O
arithmetic	O
,	O
as	O
the	O
systems	O
lack	O
hardware	O
float-point	O
units	O
.	O
</s>
<s>
The	O
PlayStation	B-Device
transformation	O
coprocessor	O
supports	O
16-bit	O
fixed	O
point	O
with	O
12	O
fraction	O
bits	O
.	O
</s>
<s>
The	O
TeX	B-Application
typesetting	O
software	O
,	O
widely	O
used	O
by	O
scientists	O
and	O
mathematicians	O
,	O
uses	O
32-bit	O
signed	O
binary	O
fixed	O
point	O
with	O
16	O
fraction	O
bits	O
for	O
all	O
position	O
calculations	O
.	O
</s>
<s>
TeX	B-Application
font	O
metric	O
files	O
use	O
32-bit	O
signed	O
fixed-point	O
numbers	O
,	O
with	O
12	O
fraction	O
bits	O
.	O
</s>
<s>
Tremor	B-Application
,	O
Toast	O
and	O
MAD	B-Algorithm
are	O
software	O
libraries	O
which	O
decode	O
the	O
Ogg	B-Algorithm
Vorbis	I-Algorithm
,	O
GSM	B-Algorithm
Full	I-Algorithm
Rate	I-Algorithm
and	O
MP3	B-Application
audio	I-Application
formats	O
respectively	O
.	O
</s>
<s>
The	O
Wavpack	B-Application
lossless	O
audio	O
compressor	O
uses	O
fixed	O
point	O
arithmetic	O
.	O
</s>
<s>
The	O
choice	O
was	O
justified	O
by	O
,	O
among	O
other	O
things	O
,	O
the	O
worry	O
that	O
different	O
floating-point	B-Algorithm
rounding	B-Algorithm
rules	O
in	O
different	O
hardware	O
could	O
corrupt	O
the	O
lossless	O
nature	O
of	O
the	O
compression	O
.	O
</s>
<s>
The	O
OpenGL	B-Application
ES	I-Application
1.x	O
specification	O
includes	O
a	O
fixed	O
point	O
profile	O
,	O
as	O
it	O
is	O
an	O
API	O
aimed	O
for	O
embedded	B-Architecture
systems	I-Architecture
,	O
which	O
do	O
not	O
always	O
have	O
an	O
FPU	O
.	O
</s>
<s>
The	O
dc	B-Application
and	O
bc	B-Application
programs	O
are	O
arbitrary	B-Algorithm
precision	I-Algorithm
calculators	O
,	O
but	O
only	O
keep	O
track	O
of	O
a	O
(	O
user-specified	O
)	O
fixed	O
number	O
of	O
fractional	O
digits	O
.	O
</s>
<s>
Fractint	B-Application
represents	O
numbers	O
as	O
Q2.29	B-Algorithm
fixed-point	O
numbers	O
,	O
to	O
speed	O
up	O
drawing	O
on	O
old	O
PCs	B-Device
with	O
386	B-General_Concept
or	O
486SX	B-Device
processors	B-General_Concept
,	O
which	O
lacked	O
an	O
FPU	O
.	O
</s>
<s>
Doom	B-Application
was	O
the	O
last	O
first-person	O
shooter	O
game	O
by	O
id	O
Software	O
to	O
use	O
a	O
16.16	O
fixed	O
point	O
representation	O
for	O
all	O
of	O
its	O
non-integer	O
computations	O
,	O
including	O
map	O
system	O
,	O
geometry	O
,	O
rendering	O
,	O
and	O
player	O
movement	O
.	O
</s>
<s>
This	O
representation	O
is	O
still	O
used	O
in	O
modern	O
Doom	B-Application
source	O
ports	O
.	O
</s>
<s>
The	O
Q#	B-Device
programming	O
language	O
for	O
the	O
Azure	B-Application
quantum	B-Architecture
computers	I-Architecture
,	O
that	O
implement	O
quantum	O
logic	O
gates	O
,	O
contains	O
a	O
standard	O
numeric	B-Algorithm
library	O
for	O
performing	O
fixed-point	O
arithmetic	O
on	O
registers	O
of	O
qubits	O
.	O
</s>
