C 参考手册
- C 语言
 - C 关键词
 - 预处理器
 - C 标准库头文件
 - 类型支持
 - 程序支持工具
 - 变参数函数
 - 错误处理
 - 动态内存管理
 - 日期和时间工具
 - 字符串库
 - 算法
 - 数值
 - 常用数学函数
 - MATH_ERRNO, MATH_ERREXCEPT, math_errhandling
 - log, logf, logl
 - log10, log10f, log10l
 - log1p, log1pf, log1pl
 - log2, log2f, log2l
 - cbrt, cbrtf, cbrtl
 - fmax, fmaxf, fmaxl
 - fmin, fminf, fminl
 - fdim
 - NAN
 - exp, expf, expl
 - exp2, exp2f, exp2l
 - expm1, expm1f, expm1l
 - fmod, fmodf, fmodl
 - remainder, remainderf, remainderl
 - remquo, remquof, remquol
 - fma, fmaf, fmal
 - div, ldiv, lldiv, imaxdiv
 - fabs, fabsf, fabsl
 - sqrt, sqrtf, sqrtl
 - sin, sinf, sinl
 - abs, labs, llabs, imaxabs
 - hypot, hypotf, hypotl
 - pow, powf, powl
 - cos, cosf, cosl
 - tan, tanf, tanl
 - asin, asinf, asinl
 - acos, acosf, acosl
 - atan, atanf, atanl
 - atan2, atan2f, atan2l
 - sinh, sinhf, sinhl
 - cosh, coshf, coshl
 - tanh, tanhf, tanhl
 - asinh, asinhf, asinhl
 - acosh, acoshf, acoshl
 - atanh, atanhf, atanhl
 - erf, erff, erfl
 - erfc, erfcf, erfcl
 - lgamma, lgammaf, lgammal
 - tgamma, tgammaf, tgammal
 - ceil, ceilf, ceill
 - floor, floorf, floorl
 - round, roundf, roundl, lround, lroundf, lroundl, llround, llroundf, llroundl
 - trunc, truncf, truncl
 - nearbyint, nearbyintf, nearbyintl
 - rint, rintf, rintl, lrint, lrintf, lrintl, llrint, llrintf, llrintl
 - ldexp, ldexpf, ldexpl
 - scalbn, scalbnf, scalbnl, scalbln, scalblnf, scalblnl
 - ilogb, ilogbf, ilogbl
 - logb, logbf, logbl
 - frexp, frexpf, frexpl
 - modf, modff, modfl
 - nextafter, nextafterf, nextafterl, nexttoward, nexttowardf, nexttowardl
 - copysign, copysignf, copysignl
 - fpclassify
 - isfinite
 - isinf
 - isnan
 - isnormal
 - signbit
 - isgreater
 - isgreaterequal
 - isless
 - islessequal
 - islessgreater
 - isunordered
 - float_t, double_t
 - HUGE_VALF, HUGE_VAL, HUGE_VALL
 - INFINITY
 - FP_NORMAL, FP_SUBNORMAL, FP_ZERO, FP_INFINITE, FP_NAN
 - 浮点环境
 - 伪随机数生成
 - 复数算术
 - 泛型数学
 - 文件输入/输出
 - 本地化支持
 - 原子操作库
 - 线程支持库
 - 实验性 C 标准库
 - 有用的资源
 - 符号索引
 - 注释
 
erfc, erfcf, erfcl
|   定义于头文件  <math.h>
  | 
||
|   float       erfcf( float arg );  | 
(1) | (C99 起) | 
|   double      erfc( double arg );  | 
(2) | (C99 起) | 
|   long double erfcl( long double arg );  | 
(3) | (C99 起) | 
|   定义于头文件  <tgmath.h>
  | 
||
|   #define erfc( arg )  | 
(4) | (C99 起) | 
4) 泛型宏:若 
arg 拥有 long double 类型,则调用 erfcl 。否则,若 arg 拥有整数类型或 double 类型,则调用 erfc 。否则,调用 erfcf 。参数
| arg | - | 浮点值 | 
返回值
若不出现错误,则返回arg 的补误差函数的值,即 | 2 | 
| √π | 
arge-t2
dt 或 1-erf(arg) 。
若出现源于下溢的值域错误,则返回(舍入后的)正确结果。
错误处理
报告 math_errhandling 中指定的错误。
若实现支持 IEEE 浮点算术( IEC 60559 ),则
- 若参数为 +∞ ,则返回 +0
 - 若参数为 -∞ ,则返回 2
 - 若参数为 NaN ,则返回 NaN
 
注解
对于 IEEE 兼容的 double 类型,若 arg > 26.55 则保证下溢。
示例
运行此代码
#include <stdio.h> #include <math.h> double normalCDF(double x) // Phi(-∞, x) 又称为 N(x) { return erfc(-x/sqrt(2))/2; } int main(void) { puts("normal cumulative distribution function:"); for(double n=0; n<1; n+=0.1) printf("normalCDF(%.2f) %5.2f%%\n", n, 100*normalCDF(n)); puts("special values:"); printf("erfc(-Inf) = %f\n", erfc(-INFINITY)); printf("erfc(Inf) = %f\n", erfc(INFINITY)); }
输出:
normal cumulative distribution function: normalCDF(0.00) 50.00% normalCDF(0.10) 53.98% normalCDF(0.20) 57.93% normalCDF(0.30) 61.79% normalCDF(0.40) 65.54% normalCDF(0.50) 69.15% normalCDF(0.60) 72.57% normalCDF(0.70) 75.80% normalCDF(0.80) 78.81% normalCDF(0.90) 81.59% normalCDF(1.00) 84.13% special values: erfc(-Inf) = 2.000000 erfc(Inf) = 0.000000
引用
- C11 standard (ISO/IEC 9899:2011):
 
- 7.12.8.2 The erfc functions (p: 249-250)
 
- 7.25 Type-generic math <tgmath.h> (p: 373-375)
 
- F.10.5.2 The erfc functions (p: 525)
 
- C99 standard (ISO/IEC 9899:1999):
 
- 7.12.8.2 The erfc functions (p: 230)
 
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
 
- F.9.5.2 The erfc functions (p: 462)
 
参阅
|    (C99)(C99)(C99)  | 
   计算误差函数   (函数)  |