fegetenv or fesetenv Subroutine

Purpose

Gets and sets the current floating-point environment.

Syntax

#include <fenv.h>

int fegetenv (envp)
fenv_t *envp;

int fesetenv (envp)
const fenv_t *envp;

Description

The fegetenv subroutine stores the current floating-point environment in the object pointed to by the envp parameter.

The fesetenv subroutine attempts to establish the floating-point environment represented by the object pointed to by the envp parameter. The envp parameter points to an object set by a call to the fegetenv or feholdexcept subroutines, or equal a floating-point environment macro. The fesetenv subroutine does not raise floating-point exceptions. It only installs the state of the floating-point status flags represented through its argument.

Parameters

Item Description
envp Points to an object set by a call to the fegetenv or feholdexcept subroutines, or equal a floating-point environment macro.

Return Values

If the representation was successfully stored, the fegetenv subroutine returns zero. Otherwise, it returns a nonzero value. If the environment was successfully established, the fesetenv subroutine returns zero. Otherwise, it returns a nonzero value.