1 |
dashley |
140 |
%$Header$ |
2 |
|
|
|
3 |
|
|
\chapter[Solutions: \ccilzeroxrefcomma{}Chapter \ref{ccil0}] |
4 |
|
|
{Solutions: \ccilzeroxrefcomma{}Chapter \ref{ccil0}, \ccilzerolongtitle{}} |
5 |
|
|
|
6 |
|
|
\label{ccis0} |
7 |
|
|
|
8 |
|
|
\vworkexercisechapterheader{} |
9 |
|
|
\begin{vworkexercisesolution}{\ref{exe:ccil0:sexe0:01}} |
10 |
|
|
We can show this result in two ways. The first way, based on bit patterns, is to note |
11 |
|
|
that adding an $m$-bit number, $u$, to its one's complement will result in a bit pattern |
12 |
|
|
containing all 1's, i.e. $\forall i$, $u_{[i]} = 1$. Adding 1 to this bit pattern will |
13 |
|
|
always produce $\forall i$, $u_{[i]} = 0$ with a carry out. Since the order of addition |
14 |
|
|
does not matter, this establishes that adding $u$ to $\sim{}u+1$ will produce 0, thus showing |
15 |
|
|
that $u$ and $\sim{}u+1$ are additive inverses. This method, although valid, does not |
16 |
|
|
establish that $u$ and $\sim{}u+1$ actually represent additive inverses. For example, if |
17 |
|
|
$u=-2^{m-1}$, $u=\sim{}u+1$, and clearly a non-zero number cannot be an additive inverse of |
18 |
|
|
itself. Thus, it would be more comforting to show this result in a way that demonstrates the |
19 |
|
|
actual values of the integers represented. |
20 |
|
|
|
21 |
|
|
We present a second method now. Assume that $u \neq -2^{m-1}$, since |
22 |
|
|
$-2^{m-1}$ cannot have an additive inverse in an $m$-bit signed integer. |
23 |
|
|
If $u=0$, $\sim{}u+1=0$, so the relationship is clearly met. If $u<0$, then |
24 |
|
|
$u_{[m-1]}=1$, and by |
25 |
|
|
(\ccilzeroxrefhyphen\ref{eq:ccil0:sroi0:sros0:00}), |
26 |
|
|
|
27 |
|
|
|
28 |
|
|
\end{vworkexercisesolution} |
29 |
|
|
\vworkexercisechapterfooter |
30 |
|
|
|
31 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
32 |
|
|
\vfill |
33 |
|
|
\noindent\begin{figure}[!b] |
34 |
|
|
\noindent\rule[-0.25in]{\textwidth}{1pt} |
35 |
|
|
\begin{tiny} |
36 |
|
|
\begin{verbatim} |
37 |
dashley |
277 |
$HeadURL$ |
38 |
|
|
$Revision$ |
39 |
|
|
$Date$ |
40 |
|
|
$Author$ |
41 |
dashley |
140 |
\end{verbatim} |
42 |
|
|
\end{tiny} |
43 |
|
|
\noindent\rule[0.25in]{\textwidth}{1pt} |
44 |
|
|
\end{figure} |
45 |
dashley |
277 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
46 |
dashley |
140 |
% |
47 |
|
|
%End of file C_CIS0.TEX |