The INVALOP subroutine masks and detects invalid operation exceptions.
lflag is an INTENT(IN OUT) scalar of type LOGICAL.
It must be set to true on the first invocation of INVALOP.
On subsequent invocations, it indicates whether an invalid operation has occurred.
The initial invocation of the INVALOP subroutine masks the invalid operator interrupt on the floating-point unit.
Subsequent invocations return an lflag value of true if the exception has occurred or false if the exception has not occurred.
Examplelogical :: lflag=.true. call invalop(lflag) ! mask the divide-by-zero interrupt write(*,*) lflag ! writes F write(*,*) 0./0. ! writes -NaN call invalop(lflag) write(*,*) lflag ! writes T