Chapter Contents

Previous

Next
fesetround

fesetround



Set the floating point rounding mode

Portability: C99


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTIONS
RELATED FUNCTIONS
SEE ALSO


SYNOPSIS

   #include <fenv.h>

   int fesetround(int mode);


DESCRIPTION

fesetround is used to change the rounding mode in the current floating-point environment. The mode argument must be one of the values FE_TONEAREST, FE_TOWARDZERO, FE_UPWARD or FE_DOWNWARD, defined in fenv.h.


RETURN VALUE

fesetround returns zero if the request was successful, or a non-zero value if the request could not be honored.


CAUTIONS

fesetround returns -1 when called from a function whose default floating-point format is hexadecimal, that is, one compiled without the bfp option.

A program which calls fesetround must use the standard FENV_ACCESS pragma in an enclosing scope, or the effects are unpredictable. The pragma must also be present in any code with runs with a rounding mode other than the default, FE_TONEAREST.


RELATED FUNCTIONS

fegetround


SEE ALSO

"Mathematical Functions" in Chapter 2, "Function Categories"


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.