Numerical Methods, MAT 350
Autumn 2001

Homework: Machine epsilon

Due Wednesday, September 5, 2001 in class

As a warm-up we will do some calculations using binary numbers. Be sure to show your work!

  1. How many keys are on a piano keyboard? Write this number as a binary integer.
  2. In what year were you born? Write this number as a binary integer. Write it as binary floating point number.
  3. I have 4-byte floating point number on a computer where machine epsilon is equal to 5.96046E-8. How many binary digits are in the mantissa and in the exponent?

Here is the programming part of your assignment.

  1. Write your own program to calculate machine epsilon for double precision floating point numbers. We will discuss in class strategies for doing this.
  2. Find a standard subroutine from the Internet which returns machine epsilon. See the introduction to downloading standard subroutines
  3. The instructions for using this routine are somewhat obscure. B is the base of the floating point numbers and T is the number of bits used to hold the mantissa. Thus,
    is machine epsilon.
  4. Use the standard subroutine to calculate machine epsilon. You should call the subroutine from the program you wrote.
  5. Based on your results (and the discussion in class), calculate how many bits are use to store the mantissa and and exponent. Explain your answer. Double precision numbers are generally stored in 8 bytes of memory while single precision numbers are stored in 4 bytes of memory.
  6. Repeat the entire exercise for single precision floating point numbers.
If you get stuck, please don't spend too much time trying to fix the problem yourself: get help from me or from another student. The main purpose of this homework is to get you started with using the computers.