OVEFL Subroutine
LF Fortran 95

OVEFL Subroutine

Description

The OVEFL subroutine masks and detects floating-point overflow exceptions.


Syntax

OVEFL (lflag)

Arguments

lflag is an INTENT(IN) scalar of type LOGICAL. It is assigned the value true if an overflow exception has occurred, and false otherwise.

Remarks

lflag must be set to true on the first invocation.

The initial invocation of the OVEFL subroutine masks the overflow interrupt on the floating-point unit.

Subsequent invocation returns an lflag value of true if the exception has occurred or false if the exception has not occurred.

Example

real(kind(1.d0)) :: a=huge(a) logical :: lflag = .true. call ovefl(lflag) ! mask the overflow interrupt write(*,*) lflag ! writes F do a=a*2.d0 call ovefl(lflag)! test for overflow if(lflag) exit end do write(*,*) lflag ! writes T