Name

fegetround

Synopsis

Determines the current rounding direction in the floating-point environment

#include <fenv.h>
intfegetround( void );

The fegetround() function obtains the current rounding direction. The integer return value is negative if the rounding direction is undetermined, or equal to one of the following macros, defined in fenv.h as integer constants, if the function is successful:

FE_DOWNWARD

Round down to the next lower integer.

FE_UPWARD

Round up to the next greater integer.

FE_TONEAREST

Round up or down toward whichever integer is nearest.

FE_TOWARDZERO

Round positive values downward and negative values upward.

Example

See the examples for fmod() and fesetround() in this chapter.

Get C in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.