############################################################# # Output from 'meps' on Cray J90 (Cray 64-bit floating point) ############################################################# ############################################################# # First consider source code: Only difference between this # version and the SGI version is that here we use 'e0' # rather than 'd0' for real*8 constants. A double precision # variable or constant (d0) on a Cray system uses 16 bytes # and arithmetic involving such quantities is *not* # implemented in hardware, and consequently is very slow # compared to real*8 (e0) arithmetic. ############################################################# charon% more meps.f c----------------------------------------------------------- c Computes and reports estimate of machine epsilon. c c Recall: machine epsilon is smallest positive 'eps' c such that c c (1.0e0 + eps ) .ne. (1.0e0) c c Program accepts optional argument which specifies c division factor: values close to 1.0 will result c in more accurate estimate of machine epsilon. c----------------------------------------------------------- program meps implicit none real r8arg real default_fac parameter ( default_fac = 2.0e0 ) real eps, neweps, fac fac = r8arg(1,default_fac) write(0,*) 'meps: using division factor: ', fac eps = 1.0e0 neweps = 1.0e0 100 continue if( 1.0e0 .eq. (1.0e0 + neweps) ) then write(*,*) eps stop else eps = neweps neweps = neweps / fac end if go to 100 200 continue stop end charon% meps meps: using division factor: 2. 7.105427357601001E-15 STOP executed at line 38 in Fortran routine 'MEPS' CP: 0.004s, Wallclock: 0.021s, 3.7% of 5-CPU Machine HWM mem: 147314, HWM stack: 2048, Stack overflows: 0 charon% meps 1.01 meps: using division factor: 1.009999999999998 7.10922461021392E-15 STOP executed at line 38 in Fortran routine 'MEPS' CP: 0.008s, Wallclock: 0.019s, 8.0% of 5-CPU Machine HWM mem: 147316, HWM stack: 2048, Stack overflows: 0 charon% meps 1.0001 meps: using division factor: 1.000100000000003 7.105756717509093E-15 STOP executed at line 38 in Fortran routine 'MEPS' CP: 0.324s, Wallclock: 0.331s, 19.6% of 5-CPU Machine HWM mem: 147316, HWM stack: 2048, Stack overflows: 0