erf
, erff
, erfl
, erfc
, erfcf
, erfcl
計算值的錯誤函式或補充錯誤函式。
語法
double erf(
double x
);
float erf(
float x
); // C++ only
long double erf(
long double x
); // C++ only
float erff(
float x
);
long double erfl(
long double x
);
double erfc(
double x
);
float erfc(
float x
); // C++ only
long double erfc(
long double x
); // C++ only
float erfcf(
float x
);
long double erfcl(
long double x
);
#define erf(X) // Requires C11 or higher
#define erfc(X) // Requires C11 or higher
參數
x
浮點值。
傳回值
erf
函式會傳回 x
的高斯錯誤函式。 erfc
函式會傳回 x
的補充高斯錯誤函式。
備註
函 erf
式會計算 的 x
Gauss 錯誤函式,其定義為:
互補的 Gauss 錯誤函式定義為 1 - erf(x)。 erf
函式會傳回範圍 -1.0 到 1.0 的值。 沒有傳回錯誤。 erfc
函式會傳回範圍 0 到 2 的值。 若 x
對於 erfc
而言過大,會將 errno
變數設為 ERANGE
。
因為 C++ 允許多載,因此您可以呼叫 erf
和 erfc
多載來取得和傳回 float
和 long double
型別。 在 C 程式中,除非您使用 < tgmath.h > 宏來呼叫此函式, erf
而且 erfc
一律接受並傳回 double
。
如果您使用 < tgmath.h >erf()
宏,引數的類型會決定選取哪一個函式版本。 如需詳細資訊,請參閱 類型泛型數學 。
根據預設,此函式的全域狀態會限定于應用程式。 若要變更此行為,請參閱 CRT 中的全域狀態。
需求
函式 | 必要的標頭 |
---|---|
erf , erff , erfl , erfc , erfcf , erfcl |
<math.h> |
erf 宏觀 |
<tgmath.h> |
如需相容性詳細資訊,請參閱相容性。
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應