\documentstyle[12pt]{article}
%\documentstyle[12pt,ncs]{article}
\topmargin=-1.25in
\oddsidemargin=0in
%\evensidemargin=0in
\textwidth=6.5in
\textheight=10.5in
\parindent=0in
%\parskip=10pt
\pagestyle{empty}

%\newfont{\cmss}{cmss12.tfm}
\tolerance=3000
%\setcounter{chapter}{1}

\begin{document}

\input 370top

\centerline{{\it Class 1}: {\bf Monday August 31}}

\begin{description}
\item[SUMMARY] Machine Representation of Numbers
\item[CURRENT READING] Burden \& Faires Section 1.2
\end{description}

\underline{\bf Warm-Up}
Computers generally do {\bf not} represent numbers using the decimal (base 10) system. Instead, they commonly represent numbers using binary. We shall warm up 
by trying to recall how to convert numbers from one base to another.
In groups of 2 or 3 do the following exercises

\begin{eqnarray*}
100010_{\bf 2} = & \qquad  \qquad & 127_{\bf 10} =  \\
  & & \\
.10110011000001_{\bf 2} =  & \qquad \qquad &  66_{\bf 10} = 
\end{eqnarray*}

\underline{\bf Definitions}
A {\bf machine number} is the name we give to the representation of an actual number which a computer stores in memory. 
%In general, computers use a {\bf normalized, floating-point binary representation of a number}. 
Instead of storing the quantity $x$ a computer stores a binary approximation to it, which we shall write as $fl(x)$. \\

We call the difference between $x$ and $fl(x)$ the {\bf round-off error}.\\

For example, in certain IBM computers, 
$$ x \approx \pm (-1)^s \times q \times 16^{c-64}$$

The number $q$ is called the {\bf mantissa}. It is a 24-bit finite binary fraction.\\ 

The integer $c$ is called the {\bf exponent} or, sometimes, the {\bf characteristic}.\\

The integer $s$ is called the {\bf sign bit}. (0 is positive, 1 is negative)\\

%The numbers $s$, $q$ and $c$ are all represented in memory in binary.

Here is how a typical single-precision floating-point number $fl(x)$ is represented in a 32-bit computer:

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
0 & 1000010 & 101110011000001000000000\\
\hline
\end{tabular}
\end{center}

Let's compute what decimal number this represents:\\
\vspace*{1in}

Write down the machine number which is NEXT SMALLEST 

\begin{center}
\begin{tabular}{|c|c|c|}
\hline
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hline
\end{tabular}
\end{center}

Write down the machine number which is NEXT LARGEST 

\begin{center}
%\begin{table}[h]
\begin{tabular}{|c|c|c|}
\hline
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hline
\end{tabular}
\end{center}

\newpage

Write down the machine number which is THE LARGEST positive number this computer can represent in memory

\begin{center}
$Z = $
\begin{tabular}{|c|c|c|}
\hline
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hline
\end{tabular}
\end{center}
$$Z = $$

Write down the machine number which is THE SMALLEST positive number this computer can represent in memory

\begin{center}
$A = $
\begin{tabular}{|c|c|c|}
\hline
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hspace{.25in}  & \hspace{1in}  &  \hspace{3in} \\
\hline
\end{tabular}
\end{center}
$$A = $$

\underline{\bf Overflow and Underflow}\\
If the computer has to represent a number greater than $Z$ an error called {\bf OVERFLOW} occurs  and all computations cease.\\

If the computer has to represent a number smaller than $A$ an error called {\bf UNDERFLOW} occurs and in most cases the number is actually replaced by a zero.\\

\underline{\bf Decimal Machine Numbers}\\

We can represent the machine numbers from above as having the form

$$ \pm 0.d_1d_2d_3 \cdots d_k \times 10^n, \qquad 1 \le d_1 \le 9, 0 \le d_i \le 9$$

In our specific case $k=6$ and $-78 \le n \le 76$



Any positive real number $y$ can be normalized to be written in the form
$$y = 0. d_1 d_2 d_3 \cdots d_k d_{k+1} \cdots \times 10^n$$

So, how is this number represented by the computer, since it can only use a
finite number of digits?\\

\underline{\bf Chopping}
\vfill
\underline{\bf Rounding}
\vfill

\underline{\bf Absolute Error and Relative Error}\\
If $\tilde{p}$ is an approximation to $p$,\\ the {\bf absolute error} is $|\tilde{p} - p|$, and the {\bf relative error} is ${\displaystyle \frac{|\tilde{p} - p|}{|p|}}$, provided $p \neq 0$

\end{document}
