9.253. SPACING

9.253 SPACING — Smallest distance between two numbers of a given type

Description:

Determines the distance between the argument X and the nearest adjacent number of the same type.

Standard:

Fortran 95 and later

Class:

Elemental function

Syntax:

RESULT = SPACING(X)

Arguments:
X Shall be of type REAL.
Return value:

The result is of the same type as the input argument X.

Example:
PROGRAM test_spacing
  INTEGER, PARAMETER :: SGL = SELECTED_REAL_KIND(p=6, r=37)
  INTEGER