---
name: "feupdateenv"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/fegetenv"
---

# feupdateenv(3)

floating-point environment save and restore

Part of [fegetenv(3)](/fegetenv/3.md).

## NAME

**fegetenv**, **feholdexcept**, **fesetenv**, **feupdateenv** – floating-point environment save and restore

## LIBRARY

Math Library (libm, -lm)

## SYNOPSIS

**#include \<fenv.h\>**

**#pragma STDC FENV\_ACCESS ON**

*int*\

**fegetenv**(*fenv\_t \*envp*);

*int*\

**feholdexcept**(*fenv\_t \*envp*);

*int*\

**fesetenv**(*const fenv\_t \*envp*);

*int*\

**feupdateenv**(*const fenv\_t \*envp*);

## DESCRIPTION

The floating-point environment includes exception flags and masks, the current rounding mode, and other architecture-specific settings. However, it does not include the floating-point register file.

The **fegetenv**() function stores the current floating-point environment in the object pointed to by *envp*, whereas **feholdexcept**() saves the current environment, then clears all exception flags and masks all floating-point exceptions.

The **fesetenv**() function restores a previously saved environment. The **feupdateenv**() function restores a saved environment as well, but it also raises any exceptions that were set in the environment it replaces.

The **feholdexcept**() function is often used with **feupdateenv**() or **fesetenv**() to suppress spurious exceptions that occur as a result of intermediate computations. An example in [fenv(3)](/fenv/3.md) demonstrates how to do this.

## RETURN VALUES

The **fegetenv**(), **feholdexcept**(), **fesetenv**(), and **feupdateenv**() functions return 0 if they succeed, and non-zero otherwise.

## SEE ALSO

[feclearexcept(3)](/feclearexcept/3.md), [fenv(3)](/fenv/3.md), [feraiseexcept(3)](/feraiseexcept/3.md), [fesetenv(3)](/fesetenv/3.md), [fetestexcept(3)](/fetestexcept/3.md), [fpgetmask(3)](/fpgetmask/3.md), [fpgetprec(3)](/fpgetprec/3.md), [fpsetmask(3)](/fpsetmask/3.md), [fpsetprec(3)](/fpsetprec/3.md)

## STANDARDS

The **fegetenv**(), **feholdexcept**(), **fesetenv**(), and **feupdateenv**() functions conform to ISO/IEC 9899:1999 (“ISO C99”).

## HISTORY

These routines first appeared in FreeBSD 5.3.
