Previous: utrnr2 Up: ../plot79_u.html Next: utrp2
INTEGER FUNCTION UTRP10 (X) C$ (Power-of-Ten) C$ This function performs the seemingly trivial task of C$ determining the power of ten for the argument X when the C$ mantissa lies in the range (1,10-DELTA) (DELTA a small C$ number). Round-off errors complicate this, and simply C$ using the ALOG10 function on X=1.0E-3 on an IBM 360 or 370 C$ machine gives -4 as the power because X on conversion to C$ internal representation has the value 9.999999E-4. C$ C$ The first step required is to determine the machine C$ precision, that is, to find the smallest value EPS such C$ that 1.0 + EPS is different from 1.0. This is done by C$ FUNCTION UTREPS, rather than by setting the value in a DATA C$ statement in order to make the code machine independent. C$ Experiments indicate that the internal form of a decimal C$ number may be incorrect by as much as 2*EPS, so to be safe, C$ the quantity 10*EPS is used as a tolerance. C$ (09-APR-82)