The DIM function returns the difference between two numbers if the difference is positive; zero otherwise.

## Syntax

DIM (x,y)

*x* is an INTENT(IN) scalar or array of type INTEGER or REAL.

*y* is INTENT(IN) and of the same type and kind as *x*.

The result is of the same type as *x*. Its value is *x* - *y* if *x* is greater than *y* and zero otherwise.

## Example

integer :: i=1,j=2 real :: x=.1.,y=.5 write(*,*) dim(x,y) ! writes 0.5 write(*,*) dim(i,j) ! writes 0.0