HP-UX Reference (11i v3 07/02) - 3 Library Functions A-M (vol 6)

f
fegetexceptflag(3M) fegetexceptflag(3M)
NAME
fegetexceptflag() - get floating-point exception flags
SYNOPSIS
#include <fenv.h>
HP Integrity Server Only
int fegetexceptflag(fexcept_t *flagp, int excepts);
PA-RISC Only
void fegetexceptflag(fexcept_t *flagp, int excepts);
DESCRIPTION
The fegetexceptflag()
function stores a representation of the states of the floating-point exception
flags indicated by the argument excepts in the object pointed to by the argument flagp. The excepts argu-
ment can be constructed as a bitwise OR of the floating-point exception macros:
FE_INEXACT ,
FE_DIVBYZERO , FE_UNDERFLOW , FE_OVERFLOW , and
FE_INVALID . FE_ALL_EXCEPT represents
all the floating-point exceptions. The object into which the floating-point exception flags are stored can be
passed to
fesetexceptflag
to restore the system exception ags, but the representation of the
floating-point exception flags stored in the object is otherwise unspecified.
Use
fetestexcept(), instead of
fegetexceptflag(), to determine which floating-point exception
flags are set.
USAGE
To use this function, compile either with the default
-Ae option or with the -Aa
and -D_HPUX_SOURCE
options. Make sure your program includes <fenv.h>.
For Integrity servers, specify +Ofenvaccess on the compiler command line or place the call to this
function under the effect of an affirmative FENV_ACCESS pragma:
#pragma STDC FENV_ACCESS ON
If the FENV_ACCESS pragma is placed outside of any top-level declarations in a file, the pragma will
apply to all declarations in the compilation following the pragma until another FENV_ACCESS pragma is
encountered or until the end of the file is reached.
If the FENV_ACCESS pragma is placed at the beginning of a block (compound statement), the pragma will
apply until another FENV_ACCESS pragma is encountered or until the end of the block is reached.
For PA-RISC, you might need to use the
+Onomoveflops compiler option in order to prevent optimiza-
tions that can undermine the specified behavior of this function.
Link in the math library by specifying
-lm on the compiler or linker command line.
For more information, see the HP-UX floating-point guide for HP Integrity servers at the following site:
http://www.hp.com/go/fp
.
RETURN VALUE
Integrity Server Only
This function always returns 0, indicating that a representation was successfully stored.
PA-RISC Only
None.
ERRORS
No errors are defined.
EXAMPLES
Store the overflow and invalid floating-point exception flags:
#include <fenv.h>
/*...*/
fexcept_t flags;
/*...*/
fegetexceptflag(&flags, FE_OVERFLOW | FE_INVALID);
HP-UX 11i Version 3: February 2007 1 Hewlett-Packard Company 421