*MCS 471 --- Computer Problem 1 --- Fall 2004*

### Floating Point Arithmetic Machine Epsilon

*
Single program with computer output is
***due Wednesday 22 September 2004** in class.
*
***Supplied more explanations 17 September 2004.**

Consider a MATLAB program that investigates the double precision epsilon.
You may also use C (C, GNU C, C++ or other C)
or Fortran (F77, F90, or other F)
or Maple provided digits rounding precision are specified as 16 or more and reasonable effort made to follow the spirit of the problem.
Use the computer of your choice, within reason for this problem.
MATLAB can be found in the UIC PCLabs and some department computer labs.
However, you must hand in copies of both your

- program source code,
- your computer output.

Determine the double precision machine epsilon
(and single precision machine epsilon is optional for extra credit),

**min(eps | eps>0 & 1+eps>1)**
where **(1+eps)** denotes the appropriate **float[1+eps]>1)**
generated by the computer arithmetic in the given precision.

Use the following modified "bisectioning approximation" pseudo code fragment:

kmax = 100;
eps0 = 1;
for k = 1 to kmax
epssave = eps0;
ks = k - 1;
eps0 = eps0/2; # Bisection Step.
epsplus1 = eps0+1;
print, eps0, epsplus1;
if(epsplus1 .le. 1.e0) break; # ".le." means "less than or equal"
end
print, epssave, epssave+1; # Actual Answer is One Prior to Break.
pchop = 1-log(epssave)/log(2.e0); # Base 2 Precision?
print, pchop;
eps0 = 0;
deleps = 2^(-1-pchop);
print, deleps;
for k = 1 to 7 # Refinement Check.
eps0 = eps0 + deleps;
epsplus1 = eps0+1;
print, eps0, epsplus1;
end

Comments are preceded by the symbol #.
Use the sample MATLAB code to start:
**m-file eps64.m**
However, you may simply convert it to C, F or Maple if you wish.

Please answer the 3 specific questions in the code
(
**eps64.m**)
and also answer the additional 4 questions:

- Which is Correct, the Official Chopped (2^(1-p))
or Rounded Value (2^(1-p)/2) for Precision p?
Give a Written Answer with Your Justification Here:

- Is Rounding or Chopping Demonstrated?
Give a Written Answer to Question with Your Justification
Here (see kd=3 in code):

- Can You Find A Smaller eps0 = epsilon?
Write and Run Your new Code, supplying your code and output.
Give your Justification Here If You Can:

- Name of Your Computer System with Processor model (eg., Pentium IV),
- Name of Your Programming Language Compiler version,
- List Compiler Command Used and Options Used.
- Briefly Summarize What You Have Learned:

for ** double precision version**.

**Web Source:
****http://www.math.uic.edu/~hanson/mcs471/cp1f04.html**
Email Comments or Questions (MCS 471 only, please) to
hanson A T math uic edu

**
**