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

ID 767251
Date 3/22/2024
Public

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

Document Table of Contents

DIM

Elemental Intrinsic Function (Generic): Returns the difference between two numbers (if the difference is positive).

result = DIM (x, y)

x

(Input) Must be of type integer or real.

y

(Input) Must have the same type and kind parameters as x.

Results

The result type and kind are the same as x. The value of the result is x- y if x is greater than y; otherwise, the value of the result is zero.

The setting of compiler options specifying integer size can affect this function.

Specific Name

Argument type

Result Type

BDIM

INTEGER(1)

INTEGER(1)

IIDIM1

INTEGER(2)

INTEGER(2)

IDIM 2

INTEGER(4)

INTEGER(4)

KIDIM

INTEGER(8)

INTEGER(8)

DIM

REAL(4)

REAL(4)

DDIM

REAL(8)

REAL(8)

QDIM

REAL(16)

REAL(16)

1Or HDIM.

2Or JIDIM. For compatibility, IDIM can also be specified as a generic function for integer types.

Example

DIM (6, 2) has the value 4.

DIM (-4.0, 3.0) has the value 0.0.

The following shows another example:

  INTEGER i
  REAL r
  REAL(8) d
  i = IDIM(10, 5)            ! returns 5
  r = DIM (-5.1, 3.7)        ! returns 0.0
  d = DDIM (10.0D0, -5.0D0)  ! returns 15.0D0