名稱空間
變體
操作

標準庫標頭檔案 <cfenv> (C++11)

來自 cppreference.com
 
 
標準庫標頭檔案
演算法
<algorithm>
<numeric>
字串
<cctype>
<cstring>
<cuchar> (C++11)
<cwchar>
<cwctype>
<string_view> (C++17)
<string>
文字處理
<clocale>
<codecvt> (C++11/17/26*)
<locale>
<regex> (C++11)
<text_encoding> (C++26)   
數值
<cfenv> (C++11)
<cmath>
<complex>
<linalg> (C++26)
<numbers> (C++20)
<random> (C++11)
<simd> (C++26)
<valarray>
時間
<chrono> (C++11)
<ctime>
C 相容性
<ccomplex> (C++11/17/20*)
<ciso646> (until C++20)
<cstdalign> (C++11/17/20*)
<cstdbool> (C++11/17/20*)
<ctgmath> (C++11/17/20*)
 

此標頭檔案最初在 C 標準庫中為 <fenv.h>

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

目錄

[編輯] 型別

fenv_t
(C++11)
表示整個浮點環境的型別
(typedef) [編輯]
fexcept_t
(C++11)
表示所有浮點狀態標誌的型別
(typedef) [編輯]

[編輯] 函式

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

[編輯]

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

[編輯] 概要

#define FE_ALL_EXCEPT /* see description */
#define FE_DIVBYZERO /* see description */    // optional
#define FE_INEXACT /* see description */      // optional
#define FE_INVALID /* see description */      // optional
#define FE_OVERFLOW /* see description */     // optional
#define FE_UNDERFLOW /* see description */    // optional
 
#define FE_DOWNWARD /* see description */     // optional
#define FE_TONEAREST /* see description */    // optional
#define FE_TOWARDZERO /* see description */   // optional
#define FE_UPWARD /* see description */       // optional
 
#define FE_DFL_ENV /* see description */
 
namespace std {
    // types
    using fenv_t    = /* object type */;
    using fexcept_t = /* object type */;
 
    // functions
    int feclearexcept(int except);
    int fegetexceptflag(fexcept_t* pflag, int except);
    int feraiseexcept(int except);
    int fesetexceptflag(const fexcept_t* pflag, int except);
    int fetestexcept(int except);
    int fegetround(void);
    int fesetround(int mode);
    int fegetenv(fenv_t* penv);
    int feholdexcept(fenv_t* penv);
    int fesetenv(const fenv_t* penv);
    int feupdateenv(const fenv_t* penv);
}

[編輯] 缺陷報告

下列更改行為的缺陷報告追溯地應用於以前出版的 C++ 標準。

缺陷報告 應用於 釋出時的行為 正確的行為
LWG 3905 C++11 std::fexcept_t 必須是整數型別 它是一個物件型別