Chapter Contents

Previous

Next
feupdateenv

feupdateenv



Restore floating point environment and propagate exceptions

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTIONS
USAGE NOTES
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <fenv.h>

   void feupdateenv(const fenv_t * envp);


DESCRIPTION

feupdateenv temporarily saves the floating-point status from the current floating-point environment. It then establishes a new floating-point environment from the location addressed by envp, and raises the exceptions saved from the previous environment. An exception is raised by setting the exception bit in the floating-point status. If trapping is enabled for that exception, the exception will be trapped and a signal will be raised. If multiple exceptions are raised, the order in which they are raised is undefined, except that overflow or underflow must precede inexact.


RETURN VALUE

feupdateenv has no return value.


CAUTIONS

feupdateenv returns -1 when called from a function whose default floating-point format is hexadecimal, that is, one compiled without the bfp option.

A program which calls feupdateenv must use the standard FENV_ACCESS pragma in an enclosing scope, or the effects are unpredictable.


USAGE NOTES

A typical scenario for use of this function would be to call feholdexcept to reset the exception flags and prevent trapping, then to perform a calculation with assurance that trapping will not occur, and then to call feupdateenv to restore the previous environment, possibly trapping for exceptions which occurred during the calculation.


RELATED FUNCTIONS

fegetenv, feholdexcept, fesetenv


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.