Partager via


fegetenv

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at fegetenv1.

Stores the current floating-point environment in the specified object.

Syntax

int fegetenv(  
   fenv_t *penv  
);  
  

Parameters

penv
Pointer to an fenv_t object to contain the current floating-point environment values.

Return Value

Returns 0 if the floating-point environment was successfully stored in penv. Otherwise, returns a non-zero value.

Remarks

The fegetenv function stores the current floating-point environment in the object pointed to by penv. The floating point environment is the set of status flags and control modes that affect floating-point calculations. This includes the rounding direction mode and the status flags for floating-point exceptions. If penv does not point to a valid fenv_t object, subsequent behavior is undefined.

To use this function, you must turn off floating-point optimizations that could prevent access by using the #pragma fenv_access(on) directive prior to the call. For more information, see fenv_access.

Requirements

Function C header C++ header
fegetenv <fenv.h> <cfenv>

For additional compatibility information, see Compatibility.

See Also

Alphabetical Function Reference
fesetenv