TEPS=1
1 PRINT,TEPS,TEPS+1
IF(TEPS+1.LE.1.) GOTO 2
TEPS=TEPS/2
GOTO 1
2 EPS=2*TEPS
PREC=1-LOG(EPS)/LOG(2.)
Modify this code to print out the results
X11 = (-B+SQUAREROOT(B*B-4AC))/2A,
X21 = (-B-SQUAREROOT(B*B-4AC))/2A,
X12 = (-B-SIGN(B)SQUAREROOT(B*B-4AC))/2A
X22 = C/(A*X12),
which you must code in error free syntax in which ever language you are using.
For instance, you must find the correct functions for "SIGN" and "SQUAREROOT"
in Fortran/WatFor, C or Pascal.
The RELATIVE ERRORs are to be computed in the form (DXIJ-XIJ)/DXIJ
where DXIJ is the corresponding formula for XIJ converted completely
to "DOUBLE PRECISION" and is used as an approximation for the EXACT
(INFINITE PRECISION) result. Use 7 digit E-FORMAT in Fortran for the XIJ's
and 3 digit E-FORMAT for C and the RELATIVE ERRORs in the XIJ.
In other languages use the corresponding exponential format.
Note that the "XIJ" are just notation here for X11, X21, X12, or X22; they
must be replaced by 4 legal variables. Also note that ERRORs should always be
PRINTed in exponential format.
The result of each binary (pair) operation should be double precision
and built-in functions used should be double for DOUBLE PRECISION
variables. Why are the first two formulas (XI1's) not as accurate as the
second two (XI2's) for I=1,2?
Email Comments or Questions to hanson@math.uic.edu