Due: November 2, 2015
Every computer is limited in the amount of precision it can represent for floating-point numbers. At some point, where epsilon is very small, the following expression will be true:
1.0 == 1.0 + epsilonWrite a program to find the largest value of epsilon. Note that the value of epsilon may be different for floats and doubles. Find both values.
Your output should clearly state the values, for example in the form:
The value for epsilon is 0.1 (floating) and 0.01 (double).Please keep your output to a single line, and be sure to put a newline at the end of the line!
You are to submit this to SmartSite, not to Gradebot.
As usual, half of the extra credit will be for correctness; the other half, for style and robustness.
Your program is to be in the file “epsilon.c”.
Hint: Use 1.0 rather than 0.0 to test epsilon because most computers have special hardware instructions for handling zero when it is used in arithmetic operations.
|You can also obtain a PDF version of this.||Version of October 24, 2015 at 5:51PM|