Lahey/Fujitsu Fortran

DVCHK Subroutine

Description

The DVCHK subroutine masks and detects divide by zero exceptions.

Syntax

DVCHK (lflag)

Arguments

lflag is an INTENT(IN) scalar of type LOGICAL.

lflag must be set to true on the first invocation.

On subsequent invocations lflag is assigned the value true if a divide-by-zero exception has occurred, and false otherwise.

Remarks

The initial invocation of the DVCHK subroutine masks the divide-by-zero interrupt on the floating-point unit.

DVCHK will not check or mask zero divided by zero. Use INVALOP to check for a zero divided by zero.

Example

logical :: lflag=.true. call dvchk(lflag) ! mask the divide-by-zero interrupt write(*,*) lflag ! writes F write(*,*) 1./0. ! writes Inf call dvchk (lflag) write(*,*) lflag ! writes T