<s>
The	O
Q	B-Algorithm
notation	I-Algorithm
is	O
a	O
way	O
to	O
specify	O
the	O
parameters	O
of	O
a	O
binary	O
fixed	O
point	O
number	O
format	O
.	O
</s>
<s>
For	O
example	O
,	O
in	O
Q	B-Algorithm
notation	I-Algorithm
,	O
the	O
number	O
format	O
denoted	O
by	O
Q8.8	O
means	O
that	O
the	O
fixed	O
point	O
numbers	O
in	O
this	O
format	O
have	O
8	O
bits	O
for	O
the	O
integer	O
part	O
and	O
8	O
bits	O
for	O
the	O
fraction	O
part	O
.	O
</s>
<s>
The	O
Q	B-Algorithm
notation	I-Algorithm
,	O
as	O
defined	O
by	O
Texas	O
Instruments	O
,	O
consists	O
of	O
the	O
letter	O
followed	O
by	O
a	O
pair	O
of	O
numbers	O
mn	O
,	O
where	O
m	O
is	O
the	O
number	O
of	O
bits	O
used	O
for	O
the	O
integer	O
part	O
of	O
the	O
value	O
,	O
and	O
n	O
is	O
the	O
number	O
of	O
fraction	O
bits	O
.	O
</s>
<s>
By	O
default	O
,	O
the	O
notation	O
describes	O
signed	O
binary	O
fixed	O
point	O
format	O
,	O
with	O
the	O
unscaled	O
integer	O
being	O
stored	O
in	O
two	B-General_Concept
's	I-General_Concept
complement	I-General_Concept
format	O
,	O
used	O
in	O
most	O
binary	O
processors	O
.	O
</s>
<s>
A	O
variant	O
of	O
the	O
Q	B-Algorithm
notation	I-Algorithm
has	O
been	O
in	O
use	O
by	O
ARM	B-Architecture
.	O
</s>
<s>
For	O
example	O
,	O
a	O
16-bit	O
signed	O
integer	O
would	O
be	O
denoted	O
Q15.0	O
in	O
the	O
TI	O
variant	O
,	O
but	O
Q16.0	O
in	O
the	O
ARM	B-Architecture
variant	O
.	O
</s>
<s>
Q	B-Algorithm
numbers	I-Algorithm
are	O
a	O
ratio	O
of	O
two	O
integers	O
:	O
the	O
numerator	O
is	O
kept	O
in	O
storage	O
,	O
the	O
denominator	O
is	O
equal	O
to	O
2n	O
.	O
</s>
<s>
If	O
the	O
Q	B-Algorithm
number	I-Algorithm
's	O
base	O
is	O
to	O
be	O
maintained	O
(	O
n	O
remains	O
constant	O
)	O
the	O
Q	B-Algorithm
number	I-Algorithm
math	O
operations	O
must	O
keep	O
the	O
denominator	O
constant	O
.	O
</s>
<s>
The	O
following	O
formulas	O
show	O
math	O
operations	O
on	O
the	O
general	O
Q	B-Algorithm
numbers	I-Algorithm
and	O
.	O
</s>
<s>
To	O
maintain	O
accuracy	O
,	O
the	O
intermediate	O
multiplication	O
and	O
division	O
results	O
must	O
be	O
double	O
precision	O
and	O
care	O
must	O
be	O
taken	O
in	O
rounding	B-Algorithm
the	O
intermediate	O
result	O
before	O
converting	O
back	O
to	O
the	O
desired	O
Q	B-Algorithm
number	I-Algorithm
.	O
</s>
<s>
Using	O
C	B-Language
the	O
operations	O
are	O
(	O
note	O
that	O
here	O
,	O
Q	B-Algorithm
refers	O
to	O
the	O
fractional	O
part	O
's	O
number	O
of	O
bits	O
)	O
:	O
</s>
<s>
Unlike	O
floating	B-Algorithm
point	I-Algorithm
±Inf	O
,	O
saturated	O
results	O
are	O
not	O
sticky	O
and	O
will	O
unsaturate	O
on	O
adding	O
a	O
negative	O
value	O
to	O
a	O
positive	O
saturated	O
value	O
(	O
0x7FFF	O
)	O
and	O
vice	O
versa	O
in	O
that	O
implementation	O
shown	O
.	O
</s>
<s>
In	O
assembly	O
language	O
,	O
the	O
Signed	O
Overflow	O
flag	O
can	O
be	O
used	O
to	O
avoid	O
the	O
typecasts	O
needed	O
for	O
that	O
C	B-Language
implementation	O
.	O
</s>
