Skip to main content

Exercises 16.6 Exercises

1.

Using IEEE 754 32-bit format, what decimal number would the bit pattern \(\hex{00000000}_{16}\) represent, ignoring the special case of “zero value”.

Solution
  1. Compute \(s\text{,}\) \(e+127\text{,}\) and \(f\text{.}\)

    \begin{align*} s &= \binary{0}\\ e + 127 &= \binary{00000000}_{2}\\ e &= -127_{10}\\ f &= \binary{00000000000000000000000} \end{align*}
  2. Finally, plug these values into Equation (16.5.1). (Remember to add the hidden bit.)

    \begin{align*} (-1)^0 \times 1.00\dots 00 \times 2^{-127} &= \mbox{a very small number}\\ &\ne 0.0 \end{align*}

    so we do need the special case.

2.

Convert the following decimal numbers to 32-bit IEEE 754 format by hand:

  1. \(\displaystyle 1.0\)

  2. \(\displaystyle -0.1\)

  3. \(\displaystyle 2016.0\)

  4. \(\displaystyle 0.00390625\)

  5. \(\displaystyle -3125.3125\)

  6. \(\displaystyle 0.33\)

  7. \(\displaystyle -0.67\)

  8. \(\displaystyle 3.14\)

Answer
  1. \(\displaystyle \hex{3f80 0000}\)

  2. \(\displaystyle \hex{bdcc cccd}\)

  3. \(\displaystyle \hex{44fc 0000}\)

  4. \(\displaystyle \hex{3b80 0000}\)

  5. \(\displaystyle \hex{c543 5500}\)

  6. \(\displaystyle \hex{3ea8 f5c3}\)

  7. \(\displaystyle \hex{bf2b 851f}\)

  8. \(\displaystyle \hex{4048 f5c3}\)

3.

Convert the following hexadecimal numbers to decimal by hand using the 32-bit IEEE 754 format:

  1. \(\displaystyle \hex{4000 0000}\)

  2. \(\displaystyle \hex{bf80 0000}\)

  3. \(\displaystyle \hex{3d80 0000}\)

  4. \(\displaystyle \hex{c180 4000}\)

  5. \(\displaystyle \hex{42c8 1000}\)

  6. \(\displaystyle \hex{3f99 999a}\)

  7. \(\displaystyle \hex{42f6 e666}\)

  8. \(\displaystyle \hex{c259 48b4}\)

Answer
  1. \(\displaystyle +2.0\)

  2. \(\displaystyle -1.0\)

  3. \(\displaystyle +0.0625\)

  4. \(\displaystyle -16.03125\)

  5. \(\displaystyle 100.03125\)

  6. \(\displaystyle 1.2\)

  7. \(\displaystyle 123.449997\)

  8. \(\displaystyle -54.320999\)