DIM

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

Syntax

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 is 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.

Specific Name Argument typeResult Type
 INTEGER(1) INTEGER(1) 
IIDIM INTEGER(2) INTEGER(2)
IDIM 1INTEGER(4) INTEGER(4)
KIDIM INTEGER(8) INTEGER(8)
DIMREAL(4)REAL(4)
DDIMREAL(8)REAL(8)
QDIM 2 REAL(16)REAL(16)
1 Or JIDIM.
2 VMS and U*X

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

Examples

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