HP-UX Floating-Point Guide
Chapter 4 109
HP-UX Math Libraries on HP 9000 Systems
Math Library Basics
If your program contains an ON statement, you must compile with the +T
option in order to enable trap handling. If your program contains an ON
statement and you do not specify +T, you get a compile-time warning.
If your program does contain an ON statement, what happens depends on
the action you specify in the statement. You can specify any of the
following:
• ABORT. If you specify ABORT, the program exits.
• IGNORE. If you specify IGNORE, the default result is returned.
• CALL sub (call a subroutine). If you specify CALL sub, the
user-defined trap-handling subroutine sub is called. The subroutine
must have three or four arguments (four if the function takes two
arguments); see the HP FORTRAN/9000 Programmer’s Guide for
details. If the subroutine sets the first argument to 0, the program
exits. Otherwise, the default result is returned.
NOTE A subroutine that handles a math library error takes a different number
of arguments from a subroutine that handles an IEEE exception (as
described in “Using the ON Statement (Fortran only)” on page 157). See
the HP FORTRAN/9000 Programmer’s Guide for details.
A Program Example
The following program illustrates Fortran 77 math library error
handling. It calls DLOG with a negative argument, which is invalid.
See “Run-Time Mode Control: The fenv(5) Suite” on page 127 for
information about the fetestexcept and fegettrapenable routines.