The SPACING function returns the absolute spacing near a given number; the smallest number that can be added to the argument to produce a number that is different than the argument.
x is an INTENT(IN) scalar or array of type REAL.
The result is of the same type and kind as x. Its value is the spacing of REAL values near x.
Examplereal :: a=1.,b=1.e10 real(kind(1.d0)) :: c=1.d0,d=1.d10 write(*,*) nearest(a,1.)-a ! writes 1.1920929 write(*,*) epsilon(a) ! writes 1.1920929 write(*,*) spacing(a) ! writes 1.1920929 write(*,*) spacing(b) ! writes 1024.0000 write(*,*) spacing(c) ! writes 2.22044604925031e-16 write(*,*) spacing(d) ! writes 1.90734863281250e-06