函式
<cmath> <ctgmath>

erfc

     double erfc  (double x);      float erfcf (float x);long double erfcl (long double x);
     double erfc (double x);      float erfc (float x);long double erfc (long double x);     double erfc (T x);           // additional overloads for integral types
計算互補誤差函式
互補誤差函式 返回x互補誤差函式值。

互補誤差函式等價於
erfc(x) = 1-erf(x)
標頭檔案 <tgmath.h> 提供了此函式的型別通用宏版本。
此標頭檔案 (<cmath>) 中為整型提供了額外的過載:這些過載在計算前有效地將x轉換為double(定義為T是任何整型)。

引數

x
互補誤差函式的引數。

返回值

x的互補誤差函式值。
如果x太大,會發生下溢範圍錯誤

如果發生下溢範圍錯誤
- 並且 math_errhandling 設定了 MATH_ERRNO:全域性變數 errno 被設定為 ERANGE
- 並且 math_errhandling 設定了 MATH_ERREXCEPT:將引發 FE_UNDERFLOW

示例

1
2
3
4
5
6
7
8
9
10
11
12
/* erfc example */
#include <stdio.h>      /* printf */
#include <math.h>       /* erfc */

int main ()
{
  double param, result;
  param = 1.0;
  result = erfc (param);
  printf ("erfc(%f) = %f\n", param, result );
  return 0;
}

輸出

erfc (1.000000) = 0.157299


另見