Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > F

fesetexceptflag(3M)

HP-UX 11i Version 3: February 2007
» 

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index

NAME

fesetexceptflag() — set floating-point exception flags

SYNOPSIS

#include <fenv.h>

HP Integrity Server Only

int fesetexceptflag(const fexcept_t *flagp, int excepts);

PA-RISC Only

void fesetexceptflag(const fexcept_t *flagp, int excepts);

DESCRIPTION

The fesetexceptflag() function sets the status for the floating-point exception flags indicated by the argument excepts to the states stored in the object pointed to by flagp. The value of *flagp must have been set by a previous call to fegetexceptflag() whose second argument represented at least those floating-point exceptions represented by the argument excepts; otherwise, the effect on the indicated floating-point exception flags is undefined. This function does not raise exceptions, but only sets the state of the flags (hence no traps will be taken). The excepts argument 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.

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 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 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 all the specified flags were successfully set to the appropriate state.

PA-RISC Only

None.

ERRORS

No errors are defined.

EXAMPLES

Use fegetexceptflag() to save the current state of two floating-point exception flags. Later, use fesetexceptflag() to restore the saved state.

#include <fenv.h> /*...*/ fexcept_t saved_flags; /*...*/ fegetexceptflag(&saved_flags, FE_DIVBYZERO | FE_INEXACT); /*...*/ fesetexceptflag(&saved_flags, FE_DIVBYZERO | FE_INEXACT);

STANDARDS CONFORMANCE

fesetexceptflag() : ISO/IEC C99 (including Annex F, "IEC 60559 floating-point arithmetic")

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.