Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fpsigset(3C)

SETFPE(3X)  —  Silicon Graphics

NAME

setfpe, fpecleanup − FORTRAN and Pascal floating-point exception handling system

FORTRAN SYNOPSIS

$include /usr/include/fortfpe.h

subroutine setfpe(mode,errormask)
integer*4 mode,errormask

subroutine fpecleanup(errorcode)
integer*4 errorcode

PASCAL SYNOPSIS

#include <pascfpedefs.h>
{$I /usr/include/pascfpe.h }

procedure setfpe(var mode,errormask: longint); external;

procedure fpecleanup(var errorcode: longint);

DESCRIPTION

The routine setfpe is used to control reporting and handling of floating-point exceptions.  Unless setfpe is called at program initiation, floating-point errors will not be raised as exceptions, and may produce indeterminate results.  A call to setfpe specifies which types of floating-point errors are to be raised as exceptions, and the actions to be performed during exception processing. 

Once a floating-point exception is detected, the default action is to call the user-handler routine fpecleanup, print a message, and abort with a core dump.  The call to setfpe may inhibit the call of the handler routine, the message, or the core dump. 

The parameter mode is the sum of any or all of the following values (see /usr/include/fortfpe.h or /usr/include/pascfpedefs.h ):

NOFPECLEANUPDon’t call the subroutine fpecleanup.
NOCOREDUMPDon’t dump core when aborting.
NOMESSAGEDon’t print a message concerning the error before aborting.

The parameter errormask indicates which errors are to be ignored. It is the bitwise or of any or all of the error codes found in /usr/include/fortfpe.h or /usr/include/pascfpedefs.h:

DIVZERODivision by zero has occurred.
OVERFLOWThe operation overflowed.
NANOPOne of the operands was an IEEE not-a-number (NaN).
ILLEGALOPAn illegal operation was requested.
UNDERFLOWThe operation underflowed.
DENORMOne of the operands was denormalized.
ZEROVALSA combination of UNDERFLOW and DENORM.
ALLA combination of all errors.

NOTE: the status of the errors UNDERFLOW and DENORM must be treated similarly.  Thus, if it is opted for UNDERFLOW errors to be ignored, DENORM errors should also be ignored.  (These errors have been combined in the ZEROVALS code for this purpose.)  If ZEROVALS errors are ignored, they are treated as zero. 

Unless it is suppressed, the user routine fpecleanup is called with the errorcode.  This errorcode may be any of the errorcodes OVERFLOW, DIVZERO, NANOP, ILLEGALOP, UNDERFLOW, or DENORM listed above.  It may also be UNKNOWN, implying that the error cause cannot be determined.  The error code may also have the error INEXACT logically-ored in.  INEXACT errors arise normally from operations whose results are not exact, (e.g., 1.0/3.0).  INEXACT errors will never be indicated unless another error has occurred. 

SEE ALSO

fpsigset(3C)
“IRIS Floating Point” in UNIX Programmer’s Guide, Volume IIB. 

Version 3.6  —  December 20, 1987

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026