feupdateenv.3m (2010 09)

f
feupdateenv(3M) feupdateenv(3M)
NAME
feupdateenv( ) - update floating-point environment
SYNOPSIS
#include <fenv.h>
HP Integrity Server Only
int feupdateenv(const fenv_t *envp);
PA-RISC Only
void feupdateenv(const fenv_t *envp);
DESCRIPTION
The feupdateenv()
function saves the currently raised floating-point exceptions in its automatic
storage, installs the floating-point environment represented by the object pointed to by envp, and then
raises the saved floating-point exceptions. Use
feholdexcept()
with feupdateenv()
to hide spuri-
ous floating-point exceptions.
The argument envp must point to an object set by a call to
fegetenv() or feholdexcept()
, or equal
the macro
FE_DFL_ENV.
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 all the actions were successfully carried out.
PA-RISC Only
None.
ERRORS
No errors are defined.
EXAMPLES
Store the current floating-point environment in
holdenv, hide spurious underflow exceptions, and con-
tinue on any floating-point exceptions that occur until the call to feupdateenv() is encountered.
#include <fenv.h>
/*...*/
fenv_t holdenv;
feholdexcept(&holdenv);
/* perform operations */
if (/* test for spurious underflow */)
feclearexcept(FE_UNDERFLOW);
feupdateenv(&holdenv); /* raise accumulated exceptions */
HP-UX 11i Version 3: September 2010 1 Hewlett-Packard Company 1

Summary of content (2 pages)