Fortran Wiki
dim

Description

dim(x,y) returns the difference x-y if the result is positive; otherwise returns zero.

Standard

FORTRAN 77 and later

Class

Elemental function

Syntax

result = dim(x, y)

Arguments

  • x - The type shall be integer or real
  • y - The type shall be the same type and kind as x.

Return value

The return value is of type integer or real.

Example

program test_dim
    integer :: i
    real(8) :: x
    i = dim(4, 15)
    x = dim(4.345_8, 2.111_8)
    print *, i
    print *, x
end program test_dim

category: intrinsics