Previous: utre3 Up: ../plot79_u.html Next: utrfa
REAL FUNCTION UTREPS(X) C$ (Machine Precision Function) C$ This function returns the smallest floating point value C$ EPSILON such that X - EPSILON .LT. X .LT. X + EPSILON. It C$ has been suggested by B. Ford, NAG, J.K. Reid, A.E.R.E. C$ Harwell, and B.T. Smith, Argonne National Laboratory, in C$ FORWORD, The FORTRAN Development Newsletter, October, 1976, C$ as a function which should be available in the new ANSI C$ FORTRAN. C$ C$ UTREPS(1.0) returns the machine precision, MACHEPS, as C$ defined by J.H. Wilkinson and C. Reinsch in The Handbook of C$ Linear Algebra, and UTREPS(0.0) returns the smallest C$ floating-point number representable in the machine. C$ C$ It is important to note that because of a non-decimal C$ number representation and differing mantissa normalization C$ conventions, it does not in general hold that UTREPS(X*Y) = C$ X*UTREPS(Y). Thus one cannot simply form UTREPS(X) = C$ X*UTREPS(1.0), where UTREPS(1.0) is entered as a constant C$ value in a DATA statement. C$ C$ Caution should be exercised on those few machines (e.g. C$ Honeywell Series 6000) on which the floating-point C$ registers are larger than the memory words, since the C$ result produced may be too small, reflecting the greater C$ precision in a register. On the Honeywell Series 6000, C$ this turns out not to be a problem at present because the C$ comparison of X with X+DELTA is done by a floating-point C$ compare instruction which ignores the extra register bits. C$ C$ Similar problems exist on machines that use IEEE 754 C$ floating-point arithmetic, where computations are usually C$ done in registers at the highest precision, and then C$ reduced to working precision when they are finally stored. C$ The code here forces the compiler to store the intermediate C$ results. C$ (09-Jan-1991)