Intel® Fortran Compiler 17.0 Developer Guide and Reference

SPACING

Elemental Intrinsic Function (Generic): Returns the absolute spacing of model numbers near the argument value.

result = SPACING (x)

x

(Input) Must be of type real.

Results

The result type and kind is the same as x. The result has the value b e-p. Parameters b, e, and p are defined in Model for Real Data. If the result value is outside of the real model range, the result is TINY( x).

Example

If 3.0 is a REAL(4) value, SPACING (3.0) has the value 2 -22.

The following shows another example:

 REAL(4) res4
 REAL(8) res8, r2
 res4 = SPACING(3.0)   ! returns 2.384186E-07
 res4 = SPACING(-3.0)  ! returns 2.384186E-07
 r2   = 487923.3
 res8 = SPACING(r2)    ! returns 5.820766091346741E-011

See Also