'\" t .\" @(#)fesetround.3m 1.5 00/01/01 SMI .TH fesetround 3M "01/01/00" .SH NAME fesetround, fegetround \- control floating point rounding direction modes .SH SYNOPSIS .LP .B cc .RI "[ " "flag" " \|.\|.\|. ] " "file" " \|.\|.\|." .B -R/opt/SUNWspro/lib -L/opt/SUNWspro/lib -lm9x .RI "[ " "library" " \|.\|.\|. ]" .LP .B #include .LP .BI "int fesetround(int " round ); .LP .BI "int fegetround(void);" .LP .B #include .LP .BI "int fesetround96(int " round ); .SH DESCRIPTION .IX "fesetround function" "" "\fLfesetround()\fP function" .IX "fegetround function" "" "\fLfegetround()\fP function" .IX "fesetround96 function" "" "\fLfesetround96()\fP function" .LP \f3fesetround(\f2round\f3)\f1 sets the current rounding direction to the direction specified by \f2round\f1, which must be one of the following values (defined in \f3\f1): .LP .RS .PD 0 .TP 20 \s-1FE_TONEAREST\s0 round to nearest .TP \s-1FE_UPWARD\s0 round toward positive infinity .TP \s-1FE_DOWNWARD\s0 round toward negative infinity .TP \s-1FE_TOWARDZERO\s0 round toward zero .PD .RE .LP The default direction is \s-1FE_TONEAREST\s0 (unless it is changed by the \f3-fround\f1 compiler flag). .LP \f3fegetround(\|)\f1 returns the current rounding direction. .SH "RETURN VALUES" \f3fesetround\f1 returns zero if the requested rounding mode is established and returns a nonzero value otherwise. .SH ATTRIBUTES See .BR attributes (5) for descriptions of the following attributes: .sp .ne 10 .TS box; cbp-1 | cbp-1 l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE = Availability SPROm9xs Interface Stability Standard, Stable (see below) MT-Level MT-Safe .TE .LP The \f3fesetround\f1 function is defined by the C9X standard. In 1996, when libm9x was initially implemented, the C9X draft defined \f3fesetround\f1 to return a nonzero value if the requested rounding mode is established and zero otherwise, i.e., the opposite of the final definition incorporated in the standard. To accommodate the possibility that the standard might change, libm9x provided an alternate function named \f3fesetround96\f1 that followed the C9X draft at that time. Moreover, the \f3\f1 header file automatically redefined the name \f3fesetround\f1 to \f3fesetround96\f1 so that programs using that header file would call the alternate function. Now that C9X has been officially completed, libm9x provides a conforming implementation of \f3fesetround\f1 in addition to the alternate \f3fesetround96\f1, and \f3\f1 no longer redefines \f3fesetround\f1 to \f3fesetround96\f1. As a result, while programs compiled with the original \f3\f1 may continue to rely on the return value defined by the original C9X draft, such programs can fail if they are recompiled. In order to maintain compatibility with the original definition, programs may instead invoke the alternate \f3fesetround96\f1 function explicitly. (This function is declared in the \f3\f1 header file.) The \f3fesetround96\f1 function is not part of C9X and so retains its original behavior. Its interface stability classification is Stable. Note, however, that this function is intended to provide compatible behavior for existing programs that depend on the original C9X definition of \f3fesetround\f1; new programs should be written to use the standard function. .SH "SEE ALSO" .BR fegetenv (3M), .BR fesetprec (3M), .BR attributes (5) .LP .I Numerical Computation Guide .SH NOTES As shown in the synopsis, the recommended way to link with libm9x using \f3cc\f1 is to specify .LP .RS .BI -R install-path "/lib -L" install-path "/lib -lm9x" .RE .LP on the command line, where \f2install-path\f1 refers to the location in which the compilers are installed (/opt/SUNWspro by default). See the \f3Numerical Computation Guide\f1 for additional information about linking with libm9x.