fenv.h(3head) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

fenv.h(3head)

fenv.h(3HEAD)                       Headers                      fenv.h(3HEAD)



NAME
       fenv.h, fenv - floating-point environment

SYNOPSIS
       #include <fenv.h>

DESCRIPTION
       The <fenv.h> header defines the following data types through typedef:

       fenv_t       Represents  the  entire  floating-point  environment.  The
                    floating-point  environment  refers  collectively  to  any
                    floating-point status flags and control modes supported by
                    the implementation.


       fexcept_t    Represents the floating-point status  flags  collectively,
                    including  any  status  the implementation associates with
                    the flags. A floating-point status flag is a system  vari‐
                    able  whose value is set (but never cleared) when a float‐
                    ing-point exception is raised,  which  occurs  as  a  side
                    effect of exceptional floating-point arithmetic to provide
                    auxiliary information. A floating-point control mode is  a
                    system  variable  whose  value  can  be set by the user to
                    affect the subsequent behavior  of  floating-point  arith‐
                    metic.



       The  <fenv.h> header defines the following constants if and only if the
       implementation supports the floating-point exception by  means  of  the
       floating-point functions feclearexcept(), fegetexceptflag(), feraiseex‐
       cept(), fesetexceptflag(), and fetestexcept(). Each expands to an inte‐
       ger  constant expression with values such that bitwise-inclusive ORs of
       all combinations of the constants result in distinct values.

         FE_DIVBYZERO
         FE_INEXACT
         FE_INVALID
         FE_OVERFLOW
         FE_UNDERFLOW



       The <fenv.h> header defines the following constant, which is simply the
       bitwise-inclusive  OR of all floating-point exception constants defined
       above:

         FE_ALL_EXCEPT



       The <fenv.h> header defines the following constants. Each expands to an
       integer constant expression whose values are distinct non-negative val‐
       ues.

         FE_DOWNWARD
         FE_TONEAREST
         FE_TOWARDZERO
         FE_UPWARD



       The <fenv.h> header defines the following  constant,  which  represents
       the  default  floating-point environment (that is, the one installed at
       program startup) and has type pointer to const-qualified fenv_t. It can
       be used as an argument to the functions within the <fenv.h> header that
       manage the floating-point environment.

         FE_DFL_ENV



       The FENV_ACCESS pragma provides a means to  inform  the  implementation
       when an application might access the floating-point environment to test
       floating-point status flags or  run  under  non-default  floating-point
       control  modes.  The pragma occurs either outside external declarations
       or preceding all explicit declarations and statements inside a compound
       statement.  When outside external declarations, the pragma takes effect
       from its occurrence until another FENV_ACCESS pragma is encountered, or
       until  the  end  of the translation unit. When inside a compound state‐
       ment, the  pragma  takes  effect  from  its  occurrence  until  another
       FENV_ACCESS  pragma  is encountered (including within a nested compound
       statement), or until the end of the compound statement; at the end of a
       compound  statement  the state for the pragma is restored to its condi‐
       tion just before the compound statement. If this pragma is used in  any
       other context, the behavior is undefined.


       If  part  of  an  application  tests  floating-point status flags, sets
       floating-point control modes, or runs under non-default mode  settings,
       but  was translated with the state for the FENV_ ACCESS pragma off, the
       behavior is undefined. The default state (on or off) for the pragma  is
       implementation-defined.  (When  execution  passes  from  a  part of the
       application translated with FENV_ACCESS off to a part  translated  with
       FENV_ACCESS on, the state of the floating-point status flags is unspec‐
       ified and the floating-point control  modes  have  their  default  set‐
       tings.)

USAGE
       This  header is designed to support the floating-point exception status
       flags and directed-rounding control modes required by  the  IEC  60559:
       1989  standard,  and  other  similar  floating-point state information.
       Also, it is designed to facilitate code portability among all  systems.
       Certain  application programming conventions support the intended model
       of use for the floating-point environment:

           o      A function call does not alter its  caller's  floating-point
                  control  modes,  clear  its  caller's  floating-point status
                  flags, or depend on the state of its caller's floating-point
                  status flags unless the function is so documented.


           o      A function call is assumed to require default floating-point
                  control modes, unless its documentation promises otherwise.


           o      A function call is assumed to have the potential for raising
                  floating-point exceptions, unless its documentation promises
                  otherwise.



       With these conventions, an application can safely assume default float‐
       ing-point  control  modes (or be unaware of them). The responsibilities
       associated with accessing the floating-point environment  fall  on  the
       application that does so explicitly.


       Even  though  the  rounding  direction macros might expand to constants
       corresponding to the values of FLT_ROUNDS, they are not required to  do
       so. For example:

         #include <fenv.h>
         void f(double x)
         {
             #pragma STDC FENV_ACCESS ON
             void g(double);
             void h(double);
             /* ... */
             g(x + 1);
             h(x + 1);
             /* ... */
         }



       If  the  function g() might depend on status flags set as a side effect
       of the first x+1, or if the second x+1 might depend  on  control  modes
       set  as a side effect of the call to function g(), then the application
       must contain an appropriately placed invocation as follows:

         #pragma STDC FENV_ACCESS ON


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE  TYPEAT‐
       TRIBUTE  VALUE  _  Interface  StabilityCommitted  _  StandardSee  stan‐
       dards(7).


SEE ALSO
       feraiseexcept(3M),   feclearexcept(3M),   fegetenv(3M),    fegetexcept‐
       flag(3M),  fegetround(3M), feholdexcept(3M), fesetenv(3M), fesetexcept‐
       flag(3M),    fesetround(3M),     fetestexcept(3M),     feupdateenv(3M),
       attributes(7), standards(7)



Oracle Solaris 11.4               15 Dec 2003                    fenv.h(3HEAD)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3