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

# fegetmode(3)

save and restore floating-point control modes

## NAME

**fegetmode**, **fesetmode** – save and restore floating-point control modes

## LIBRARY

Math Library (libm, -lm)

## SYNOPSIS

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

**#pragma STDC FENV\_ACCESS ON**

*int*\

**fegetmode**(*femode\_t \*modep*);

*int*\

**fesetmode**(*const femode\_t \*modep*);

## DESCRIPTION

The *femode\_t* type represents the dynamic floating-point control modes, including the rounding direction and, where supported, exception masks and other implementation-defined modes.

The **fegetmode**() function stores the current control modes in the object pointed to by *modep*.

The **fesetmode**() function establishes the control modes represented by *modep*. The argument *modep* must point to an object set by a prior call to **fegetmode**(), or equal FE\_DFL\_MODE. FE\_DFL\_MODE expands to a pointer to the default control modes( installed at program startup).

## RETURN VALUES

The **fegetmode**() and **fesetmode**() functions return 0 if they succeed, and non-zero otherwise; however, the present implementation always succeeds.

## SEE ALSO

[fegetround(3)](/fegetround/3.md), [fenv(3)](/fenv/3.md), [fesetround(3)](/fesetround/3.md)

## STANDARDS

The **fegetmode**() and **fesetmode**() functions conform to ISO/IEC 9899:2024 (“ISO C23”).

## HISTORY

These routines first appeared in FreeBSD 16.0.
