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 type | Result Type |
---|---|---|
BDIM | INTEGER(1) | INTEGER(1) |
IIDIM 1 | INTEGER(2) | INTEGER(2) |
IDIM 2 | INTEGER(4) | INTEGER(4) |
KIDIM 3 | INTEGER(8) | INTEGER(8) |
DIM | REAL(4) | REAL(4) |
DDIM | REAL(8) | REAL(8) |
QDIM | REAL(16) | REAL(16) |
1 Or HDIM. 2 Or JIDIM. For compatibility, IDIM can also be specified as a generic function. 3 Or KDIM. |
See Also
Argument Keywords in Intrinsic Procedures
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