function
<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
Compute complementary error function
complementary error function Returns the complementary error function value for x.

The complementary error function is equivalent to:
erfc(x) = 1-erf(x)
Header <tgmath.h> provides a type-generic macro version of this function.
Additional overloads are provided in this header (<cmath>) for the integral types: These overloads effectively cast x to a double before calculations (defined for T being any integral type).

Parameters

x
Parameter for the complementary error function.

Return Value

Complementary error function value for x.
If x is too large, an underflow range error occurs.

If an underflow range error occurs:
- And math_errhandling has MATH_ERRNO set: the global variable errno is set to ERANGE.
- And math_errhandling has MATH_ERREXCEPT set: FE_UNDERFLOW is raised.

Example

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;
}


Output:

erfc (1.000000) = 0.157299

See also