Skip to main content
Mathematics LibreTexts

1.9: Inexact Numbers

  • Page ID
    96035
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    Example:

    \[\frac{1}{3}=(-1)^{0} \times \frac{1}{4} \times\left(1+\frac{1}{3}\right) \text {, } \nonumber \]

    so that \(p=e-127=-2\) and \(e=125=128-3\), or in binary, \(e=01111101\). How is \(f=1 / 3\) represented in binary? To compute binary number, multiply successively by 2 as follows:

    \(\begin{array}{lr}0.333 \ldots & 0 . \\ 0.666 \ldots & 0.0 \\ 1.333 \ldots & 0.01 \\ 0.666 \ldots & 0.010 \\ 1.333 \ldots & 0.0101 \\ \text { etc. } & \end{array}\)

    so that \(1 / 3\) exactly in binary is \(0.010101 \ldots\) With only 23 bits to represent \(f\), the number is inexact and we have

    \[f=01010101010101010101011 \nonumber \]

    where we have rounded to the nearest binary number (here, rounded up). The machine number \(1 / 3\) is then represented as

    \[00111110101010101010101010101011 \nonumber \]

    or in hex

    \[\text { Зeaaaaab. } \nonumber \]

    Find smallest positive integer that is not exact in single pre- cision

    Let \(N\) be the smallest positive integer that is not exact. Now, I claim that

    \[N-2=2^{23} \times 1.11 \ldots 1 \nonumber \]

    and

    \[N-1=2^{24} \times 1.00 \ldots 0 \nonumber \]

    The integer \(N\) would then require a one-bit in the \(2^{-24}\) position, which is not available. Therefore, the smallest positive integer that is not exact is \(2^{24}+1=16777217\). In MATLAB, single \(\left(2^{24}\right)\) has the same value as single \(\left(2^{24}+1\right) .\) Since single \(\left(2^{24}+1\right)\) is exactly halfway between the two consecutive machine numbers \(2^{24}\) and \(2^{24}+2\), MATLAB rounds to the number with a final zero-bit in \(f\), which is \(2^{24} .\)


    This page titled 1.9: Inexact Numbers is shared under a CC BY 3.0 license and was authored, remixed, and/or curated by Jeffrey R. Chasnov via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.