Rate This Document
Findability
Accuracy
Completeness
Readability

erfc

Complementary error function. The input parameter is a real number. erfc(x) = 1 - erf(x)

Interface Definition

C interface:

float erfcf(float x);

double erfc(double x);

Parameters

Parameter

Type

Description

Input/Output

x

  • For erfcf, x is of single-precision floating-point type.
  • For erfc, x is of double-precision floating-point type.

Floating-point value of the input data.

Input

Return Value

  • The complementary error function computing result y of the input parameter x is returned. y ∈ [0, +2]
  • If the input is NaN, the return value is NaN.
  • If the input is +∞, the return value is 0.
  • If the input is –∞, the return value is 2.
  • For the float interface, if |x| ≤ 0x1p-26, the return value is 1.
  • For the float interface, if x ≥ 0x1.466666p+3, the return value is 0.
  • For the float interface, if x ≤ -0x1.f5a88ap+1, the return value is 2.
  • For the double interface, if |x| ≤ 0x1p-70, the return value is 1.
  • For the double interface, if x ≥ 0x1.b39dc41e48bfdp+4, the return value is 0.
  • For the double interface, if x ≤ -0x1.7744f8f74e94ap+2, the return value is 2.

Dependency

C: "km.h"

Example

C interface:
    // print result
    printf("erfc(0.0) = %.15f\n",erfc(0.0));
    printf("erfc(-0.0) = %.15f\n",erfc(-0.0));
    printf("erfc(0.25) = %.15f\n",erfc(0.25));
    printf("erfc(-0.25) = %.15f\n",erfc(-0.25));
    printf("erfc(0.5) = %.15f\n",erfc(0.5));
    printf("erfc(-0.5) = %.15f\n",erfc(-0.5));
    printf("erfc(1.0) = %.15f\n",erfc(1.0));
    printf("erfc(-1.0) = %.15f\n",erfc(-1.0));
    printf("erfc(2.0) = %.15f\n",erfc(2.0));
    printf("erfc(-2.0) = %.15f\n",erfc(-2.0));
    printf("erfc(INFINITY) = %.15f\n",erfc(INFINITY));
    printf("erfc(-INFINITY) = %.15f\n",erfc(-INFINITY));
    printf("erfc(NAN) = %.15f\n",erfc(NAN));
    printf("erfc(-NAN) = %.15f\n",erfc(-NAN));
    /* 
     * erfc(0.0) = 1.000000000000000
     * erfc(-0.0) = 1.000000000000000
     * erfc(0.25) = 0.723673609831763
     * erfc(-0.25) = 1.276326390168237
     * erfc(0.5) = 0.479500122186953
     * erfc(-0.5) = 1.520499877813047
     * erfc(1.0) = 0.157299207050285
     * erfc(-1.0) = 1.842700792949715
     * erfc(2.0) = 0.004677734981047
     * erfc(-2.0) = 1.995322265018953
     * erfc(INFINITY) = 0.000000000000000
     * erfc(-INFINITY) = 2.000000000000000
     * erfc(NAN) = nan
     * erfc(-NAN) = -nan
     * 
     * */