Lahey/Fujitsu Fortran

DVCHK Subroutine


The DVCHK subroutine masks and detects divide by zero exceptions.


DVCHK (lflag)


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.


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.


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