HPlogo HP-UX Reference > F

fegettrapenable(3M)

HP-UX 11i Version 2: December 2007 Update
» 

Technical documentation

 » Table of Contents

 » Index

NAME

fegettrapenable() — get floating-point exception trap enables

SYNOPSIS

#include <fenv.h>

int fegettrapenable(void);

DESCRIPTION

The fegettrapenable() function determines which floating-point exception traps are currently enabled.

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 Itanium(R)-based systems, 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 optimizations 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.

RETURN VALUE

The fegettrapenable() function returns the bitwise OR of the floating-point exception macros corresponding to the currently enabled exception traps. The macros are FE_INEXACT, FE_DIVBYZERO, FE_UNDERFLOW, FE_OVERFLOW, and FE_INVALID. FE_ALL_EXCEPT represents all the floating-point exceptions.

ERRORS

No errors are defined.

EXAMPLES

Retrieve the current trap settings and determine whether a trap for the divide by zero exception is enabled.

#include <fenv.h> /*...*/ if (fegettrapenable() & FE_DIVBYZERO) printf("divide by zero trap set\\n");

AUTHOR

fegettrapenable() was developed by HP and is not required by any current standard.