fegetmode(3)

fegetmode3

Save and restore floating-point control modes

Usage

#include <fenv.h>

#pragma STDC FENV_ACCESS ON

int

fegetmode(femode_t *modep);

int

fesetmode(const femode_t *modep);

Library

Math Library (libm, -lm)

Overview

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.

Standards

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

History

These routines first appeared in FreeBSD 16.0.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.