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 |
|
|
$RCSfile: c_cis0.tex,v $ |
38 |
|
|
$Source: /home/dashley/cvsrep/e3ft_gpl01/e3ft_gpl01/dtaipubs/esrgubka/c_cis0/c_cis0.tex,v $ |
39 |
|
|
$Revision: 1.3 $ |
40 |
|
|
$Author: dtashley $ |
41 |
|
|
$Date: 2002/09/12 23:30:20 $ |
42 |
|
|
\end{verbatim} |
43 |
|
|
\end{tiny} |
44 |
|
|
\noindent\rule[0.25in]{\textwidth}{1pt} |
45 |
|
|
\end{figure} |
46 |
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
47 |
|
|
% $Log: c_cis0.tex,v $ |
48 |
|
|
% Revision 1.3 2002/09/12 23:30:20 dtashley |
49 |
|
|
% Safety checkin as changing machines. |
50 |
|
|
% |
51 |
|
|
% Revision 1.2 2002/08/26 17:57:03 dtashley |
52 |
|
|
% Additional solutions chapter added. Precautionary checkin to be sure |
53 |
|
|
% that I've captured all changes. |
54 |
|
|
% |
55 |
|
|
% Revision 1.1 2002/08/26 17:35:06 dtashley |
56 |
|
|
% Initial checkin. |
57 |
|
|
% |
58 |
|
|
%End of file C_CIS0.TEX |