Lab 1

We will explore some of the limitations of floating point numbers stored in a computer. For each pair will turn in one print out of your programs with comments.

  1. Write a program that defines a variable x and set it equal to one. The program should then repeatedly divide x by 2 until the computer can no longer distinguish it from 0.
  2. Write another program that starts with x=1 and halves x until the computer can no longer distinguish 1 from 1+x.
  3. Create another program that starts with x=1 and doubles x until the computer can no longer distinguish x from x+1.
  4. Try to find the relationship between the results of your program and the constant eps defined in Matlab. The constant is called machine epsilon; you can google it.