HP-UX Floating-Point Guide
Chapter 4 111
HP-UX Math Libraries on HP 9000 Systems
Math Library Basics
If you compile this program with the ON statements commented out and
without the +T option, no traps are enabled. Therefore, the math library
error sets the appropriate exception flag. The output of the program is as
follows:
$ f77 liberr77.f -lm
liberr77.f:
MAIN liberr:
mysub:
$ a.out
NaN 88000000 00000000
invalid operation occurred
The exception flag value indicates that both an invalid operation and an
inexact result condition were generated. (Table 5-1 on page 129 shows
the bit values for each of these conditions.).
If you compile with +T, the exception flags that correspond to the traps
set by +T are not set after an error, and it is not useful to check them.
If you remove the comment from the ON EXTERNAL ERROR ABORT
statement and compile with +T, the invalid operation trap is enabled.
When you run the program, it exits:
$ f77 +T liberr77.f -lm
liberr77.f:
MAIN liberr:
mysub:
$ a.out
$
Finally, if you remove the comment from the ON EXTERNAL ERROR CALL
MYSUB statement and compile with +T, the program calls the
error-handling subroutine MYSUB before exiting:
$ f77 +T liberr77.f -lm
liberr77.f:
MAIN liberr:
mysub:
$ a.out
error no. is 8
result is NaN
arg is -1.35795
$