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.
- 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.
- Write another program that starts with x=1 and halves x until the computer can no
longer distinguish 1 from 1+x.
- Create another program that starts with x=1 and doubles x until the computer can no
longer distinguish x from x+1.
- 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.