trpfpe(3F) trpfpe(3F)
NAME
trpfpe, fpecnt - trap and repair floating point faults
SYNOPSIS
subroutine trpfpe (numesg, rtnval)
double precision rtnval
integer function fpecnt ()
common /fpeflt/ fperr
logical fperr
DESCRIPTION
trpfpe sets up a signal handler to trap arithmetic excep-
tions. If the exception is due to a floating point arith-
metic fault, the result of the operation is replaced with
the rtnval specified. rtnval must be a double precision
value. For example, 0.0d0 or the return value of dflmax().
The first numesg occurrences of a floating point arithmetic
error will cause a message to be written to the standard
error file. Any exception that cannot be repaired will
result in the default action, typically an abort with core
image.
fpecnt returns the number of faults since the last call to
trpfpe.
The logical value in the common block labeled fpeflt will be
set to .TRUE. each time a fault occurs.
FILES
/usr/lib/libF77.a
SEE ALSO
signal(3F)
NOTES
When compiling source with the -Qocs option, an explicit
underscore needs to be added to the end of the routine
names.
When compiling source with the -Qocs option, two explicit
underscores need to be added to the end of the name of the
common block fpeflt.
BUGS
This handler just prints a message. There are no arithmetic
faults (only traps) around, so that no instruction is inter-
rupted before it completes, and the program counter points
to the next floating point instruction (not necessarily next
executable instruction after the one that got the
Page 1 CX/UX Hf77 Fortran Reference Manual
trpfpe(3F) trpfpe(3F)
exception).
If the operation involves changing the stack pointer, it
cannot be repaired. This seldom should be a problem with
the f77 compiler, but such an operation might be produced by
the optimizer.
Page 2 CX/UX Hf77 Fortran Reference Manual