Man Page fesetround.3m




NAME

     fesetround, fegetround -  control  floating  point  rounding
     direction modes


SYNOPSIS

     cc   [   flag   ...   ]   file   ...     -R/opt/SUNWspro/lib
     -L/opt/SUNWspro/lib -lm9x [ library ... ]

     #include <fenv.h>

     int fesetround(int round);

     int fegetround(void);

     #include <fenv96.h>

     int fesetround96(int round);


DESCRIPTION

     fesetround(round) sets the current rounding direction to the
     direction  specified by round, which must be one of the fol-
     lowing values (defined in <fenv.h>):

          FE_TONEAREST        round to nearest
          FE_UPWARD           round toward positive infinity
          FE_DOWNWARD         round toward negative infinity
          FE_TOWARDZERO       round toward zero

     The default direction is FE_TONEAREST (unless it is  changed
     by the -fround compiler flag).

     fegetround() returns the current rounding direction.


RETURN VALUES

     fesetround returns zero if the requested  rounding  mode  is
     established and returns a nonzero value otherwise.


ATTRIBUTES

     See attributes(5) for descriptions of the  following  attri-
     butes:

     ____________________________________________________
    |   ATTRIBUTE TYPE   |        ATTRIBUTE VALUE       |
    |____________________|_______________________________|_
    | Availability       |  SPROm9xs                    |
    | Interface Stability|  Standard, Stable (see below)|
    | MT-Level           |  MT-Safe                     |
    |____________________|______________________________|

     The fesetround function is defined by the C9X standard.   In
     1996,  when  libm9x was initially implemented, the C9X draft
     defined  fesetround  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 stan-
     dard might change, libm9x  provided  an  alternate  function
     named fesetround96 that followed the C9X draft at that time.
     Moreover, the <fenv.h> header file  automatically  redefined
     the  name  fesetround to fesetround96 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 fesetround in addition  to  the
     alternate  fesetround96,  and  <fenv.h>  no longer redefines
     fesetround to fesetround96.  As  a  result,  while  programs
     compiled  with the original <fenv.h> 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 main-
     tain compatibility with the  original  definition,  programs
     may  instead  invoke  the  alternate  fesetround96  function
     explicitly.  (This function is declared  in  the  <fenv96.h>
     header  file.)  The fesetround96 function is not part of C9X
     and so retains its original behavior.  Its interface stabil-
     ity  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 fesetround; new programs should be  written  to  use  the
     standard function.


SEE ALSO

     fegetenv(3M), fesetprec(3M), attributes(5)

     Numerical Computation Guide


NOTES

     As shown in the synopsis, the recommended way to  link  with
     libm9x using cc is to specify

          -Rinstall-path/lib -Linstall-path/lib -lm9x

     on the command line, where install-path refers to the  loca-
     tion  in which the compilers are installed (/opt/SUNWspro by
     default).  See the Numerical  Computation  Guide  for  addi-
     tional information about linking with libm9x.