OpenBSD manual page server

Manual Page Search Parameters

FEGETROUND(3) Library Functions Manual FEGETROUND(3)

fegetround, fesetroundcontrol floating-point rounding direction modes

#include <fenv.h>


fesetround(int round);

These functions provide control of floating-point rounding direction modes. The round input argument is a value specifying a rounding direction mode and containing any of the values listed below.

Results are rounded to the closest representable value. If the exact result is exactly half way between two representable values, the value whose last binary digit is even (zero) is chosen. This is the default mode.
Results are rounded towards negative infinity.
Results are rounded towards positive infinity.
Results are rounded towards zero.

The () function gets the current rounding direction.

The () function establishes the rounding direction represented by round. If the argument is not equal to the value of a rounding direction macro, the rounding direction is not changed.

The fegetround() function returns the current rounding direction. The fesetround() function return zero on success, and non-zero if an error occurred.

feclearexcept(3), feenableexcept(3), fegetenv(3)

The fegetround() and fesetround() functions conform to ISO/IEC 9899:1999 (“ISO C99”).

These functions first appeared in OpenBSD 5.0.

November 14, 2020 OpenBSD-current