\documentstyle [11pt] {article}
\pagestyle{empty}
%
\topmargin=-0.75in
\hoffset=-0.75in
\textheight=10.0in \vsize\textheight
\textwidth=6.5in \hsize\textwidth
%
\begin {document}
{\Large
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Insert source immediately following \begin{verbatim}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{verbatim}
c-----------------------------------------------------------
c     Illustrates IEEE "exceptional" floating point "values"
c 
c     By default, floating point exceptions (underflow,
c     overflow, divide by 0, inexact result) are ignored 
c     in program execution.  On the SGIs, this behaviour 
c     can be changed so that all FPE's are "trapped" and 
c     result in termination of program execution by 
c
c     (1) Linking with 'libfpe.a' 
c 
c     (2) Setting the environment variable 'TRAP_FPE' 
c         prior to program execution
c
c         setenv TRAP_FPE "ALL=ABORT"
c
c     See 'man handle_sigfpes' (FORTRAN pages) for more 
c     detailed information.
c-----------------------------------------------------------
      program         tfpe

      implicit        none

      real*8          r8arg

      real*8          divby0,     overflow,    notnumber

      divby0    = 1.0d0 / r8arg(1,0.0d0)
      write(0,*) 'divby0 = ', divby0

      overflow  = exp(1.0d10)
      write(0,*) 'overflow = ', overflow

      notnumber = sqrt(-1.0d0)
      write(0,*) 'notnumber = ', notnumber


      stop

      end
\end{verbatim}
\clearpage
\begin{verbatim}
############################################################
# Output from 'tfpe' on SGIs (Illustrates IEEE exceptional
# values).  This is the normal output where floating 
# point exceptions are ignored and program execution 
# continues.
############################################################

einstein% tfpe
 divby0 = Infinity                
 overflow = Infinity                
 notnumber = nan
\end{verbatim}
\clearpage
\begin{verbatim}
############################################################
# Output from 'tfpe' on SGIs illustrating exception
# trapping via 'libfpe.a' and 'TRAP_FPE' environment vbl
############################################################

einstein% make tfpe
        f77 -g -c tfpe.f
as1: Warning: tfpe.f, line 27: number outside range for double 
     precision floating point values
        f77 -g -L/usr/local/lib tfpe.o -lp329f -lfpe -o tfpe

einstein% setenv TRAP_FPE "ALL=ABORT"


einstein% tfpe
IOT Trap
Abort


############################################################
# The debugger (dbx) can help you isolate the problem
############################################################
einstein% dbx tfpe
dbx version 3.18 Feb 14 1994 00:52:47
Type 'help' for help.
Process  5099 (tfpe) started
[2] Process  5099 (tfpe) stopped at [tfpe:29 ,0x4022b4]
  29  divby0    = 1.0d0 / r8arg(1,0.0d0)
(dbx) run
Process  5099 (tfpe) terminated
Process  5100 (tfpe) started
Process  5100 (tfpe)  Floating point exception (Signal 8) 
                      [tfpe:29 +0x2c,0x4022e0]
  29  divby0    = 1.0d0 / r8arg(1,0.0d0)
(dbx) 
\end{verbatim}
\clearpage
\begin{verbatim}
############################################################
# Output from 'tfpe' on the Cray J90.  The Cray (sensibly)
# traps all floating point exceptions by default.
############################################################

charon% tfpe
tfpe
Floating point exception

 Beginning of Traceback:
  Started from address 424b in routine 'TFPE'.
  Called from line 316 (address 21774b) in routine '$START$'.
 End of Traceback.
Floating exception (core dumped)
\end{verbatim}
}
%
\end {document}
