函式
<cmath> <ctgmath>

erf

     double erf  (double x);      float erff (float x);long double erfl (long double x);
     double erf (double x);      float erf (float x);long double erf (long double x);     double erf (T x);           // additional overloads for integral types
計算誤差函式
誤差函式 返回 x誤差函式值。

標頭檔案 <tgmath.h> 提供了此函式的型別通用宏版本。
此標頭檔案(<cmath>)為整型提供了額外的過載:這些過載在計算前有效地將 x 轉換為 double(為任意整型T 定義)。

引數

x
用於誤差函式的引數。

返回值

x 的誤差函式值。

示例

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

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

輸出

erf (1.000000) = 0.842701


另見