Section 6.1 Digital Representation of Floats
Recall the funny division behavior we notice in the C programming language when using integers. Feel free to play around in this code window to refresh your memory and experiment in order to analyze this behavior.
Check Your Understanding Check Your Understanding
2.
3.
So far we have learned how integers (positive and negative) are stored in the computer’s memory. How about decimal numbers, also known as floats?
In this next video you’ll find out how floats are stored in memory!
How are real numbers (floats) represented/stored in the computer?
Example: -5,032.4235
Write in scientific notation (decimal):
\begin{equation*}
-5.0324235\times 10^3
\end{equation*}
In binary, this representation takes on the following form:
\begin{equation*}
-1.mantissa\times 2^{exp}
\end{equation*}

Special cases:
-
Smallest possible exponent --> number = 0
-
Largest possible exponent --> number = NaN (infinity)
Double
: often 8 bytes
Check Your Understanding Check Your Understanding
1.
The binary representation of the decimal number 0.75 is 0.11 (which basically stands for \(2^{-1} + 2^{-2} = \frac{1}{2} + \frac{1}{4} = 0.75\)). In scientific notation, this binary number would be written as:
\begin{equation*}
1.1 * 2^{-1}
\end{equation*}
Suppose now that 0.75 is stored (in the binary representation) as a float. In this representation, choose the correct option for the following components of the float: