Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

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 are 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