名稱空間
變體
操作

標準庫標頭檔案 <fenv.h> (C99)

來自 cppreference.com

此標頭檔案是浮點環境庫的一部分。

目錄

[編輯] 型別

定義於標頭檔案 <fenv.h>
fenv_t 表示整個浮點環境的型別
fexcept_t 表示所有浮點狀態標誌集合的型別

[編輯] 函式

清除指定的浮點狀態標誌
(函式) [編輯]
確定哪些指定的浮點狀態標誌已設定
(函式) [編輯]
引發指定的浮點異常
(函式) [編輯]
從浮點環境或向浮點環境複製指定浮點狀態標誌的狀態
(函式) [編輯]
獲取或設定舍入方向
(函式) [編輯]
儲存或恢復當前浮點環境
(函式) [編輯]
儲存環境,清除所有狀態標誌並忽略所有未來錯誤
(函式) [編輯]
恢復浮點環境並引發先前引發的異常
(函式) [編輯]

[編輯]

浮點異常
(宏常量) [編輯]
浮點舍入方向
(宏常量) [編輯]
預設浮點環境
(宏常量) [編輯]

[編輯] 綱要

#define __STDC_VERSION_FENV_H__ 202311L
 
#define FE_ALL_EXCEPT         /* see description */
#define FE_DIVBYZERO          /* see description */
#define FE_INEXACT            /* see description */
#define FE_INVALID            /* see description */
#define FE_OVERFLOW           /* see description */
#define FE_UNDERFLOW          /* see description */
#define FE_DOWNWARD           /* see description */
#define FE_TONEARESTFROMZERO  /* see description */
#define FE_TONEAREST          /* see description */
#define FE_TOWARDZERO         /* see description */
#define FE_UPWARD             /* see description */
#define FE_DFL_ENV            /* see description */
#define FE_DFL_MODE           /* see description */
 
#define fenv_t                /* see description */
#define fexcept_t             /* see description */
#define femode_t              /* see description */
 
#pragma STDC FENV_ACCESS      /*on-off-switch*/
#pragma STDC FENV_ROUND       direction
#pragma STDC FENV_ROUND       FE_DYNAMIC
 
// functions
int feclearexcept(int excepts);
int fegetexceptflag(fexcept_t* flagp, int excepts);
int feraiseexcept(int excepts);
int fesetexcept(int excepts);
int fesetexceptflag(const fexcept_t* flagp, int excepts);
int fetestexceptflag(const fexcept_t* flagp, int excepts);
int fetestexcept(int excepts);
int fegetmode(femode_t* modep);
int fegetround(void);
int fesetmode(const femode_t* modep);
int fesetround(int rnd);
int fegetenv(fenv_t* envp);
int feholdexcept(fenv_t* envp);
int fesetenv(const fenv_t* envp);
int feupdateenv(const fenv_t* envp);
 
// Only if the implementation defines __STDC_IEC_60559_DFP__:
#define FE_DEC_DOWNWARD            /* implementation-defined */
#define FE_DEC_TONEARESTFROMZERO   /* implementation-defined */
#define FE_DEC_TONEAREST           /* implementation-defined */
#define FE_DEC_TOWARDZERO          /* implementation-defined */
#define FE_DEC_UPWARD              /* implementation-defined */
 
#pragma STDC FENV_DEC_ROUND /*dec-direction*/
int fe_dec_getround(void);
int fe_dec_setround(int rnd);
 
// Only if the implementation follows the recommended practice from F.2.2:
#define FE_SNANS_ALWAYS_SIGNAL /* implementation-defined */