4.3BSD/usr/man/man3/trpfpe.3f

.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.  The Berkeley software License Agreement
.\" specifies the terms and conditions for redistribution.
.\"
.\"	@(#)trpfpe.3f	6.1 (Berkeley) 5/15/85
.\"
.TH TRPFPE 3F "May 15, 1985"
.UC 5
.SH NAME
trpfpe, fpecnt \- trap and repair floating point faults
.SH SYNOPSIS
.B subroutine trpfpe (numesg, rtnval)
.br
.B double precision rtnval
.sp 1
.B integer function fpecnt ()
.sp 1
.B common /fpeflt/ fperr
.br
.B logical fperr
.SH DESCRIPTION
\fBNOTE: This routine applies only to Vax computers.\fR
It is a null routine on the PDP11.
.PP
.I Trpfpe
sets up a signal handler to trap arithmetic exceptions.
If the exception is due to a floating point arithmetic fault,
the result of the operation is replaced with the
.I rtnval
specified.
.I Rtnval
must be a double precision value. For example, ``0d0'' or ``dflmax()''.
.PP
The first
.I numesg
occurrences of a floating point arithmetic error will cause a message
to be written to the standard error file.
Any exception that can't be repaired will result in the default
action, typically an abort with core image.
.PP
.I Fpecnt
returns the number of faults since the last call to
.IR trpfpe .
.PP
The logical value in the common block labelled
.I fpeflt
will be set to
.B .true.
each time a fault occurs.
.SH FILES
.ie \nM /usr/ucb/lib/libF77.a
.el /usr/lib/libF77.a
.SH SEE ALSO
signal(3F), range(3F)
.SH BUGS
This routine works only for
.IR faults ,
not
.IR traps .
This is primarily due to the Vax architecture.
.PP
If the operation involves changing the stack pointer, it can't be repaired.
This seldom should be a problem with the f77 compiler, but such an operation
might be produced by the optimizer.
.PP
The POLY and EMOD opcodes are not dealt with.