The erfcl function is defined in the tgmath.h header file in C. It takes in a single parameter: a long double value. It then computes the complementary error function of the given argument and returns a type long double value.
The complementary error function in mathematics is defined as follows:
erfc =
=
The argument to the
erfclfunction serves as the lower limit in the integral above.
The error function is most often used in probability and statistics. It integrates the normal distribution and gives the probability that a normally distributed random variable Y (with mean 0 and variance ½) falls into the range [−x, x].
The complementary error function, combined with its series expansion, provides approximate expressions for small and large values of x.
The
erfcfunction in mathematics caters to values of all types. There is a unique function for each data type in C.
The figure below shows the plot of the erfc function:
The illustration below shows how erfcl function works:
The erfcl function is defined as follows:
long double erfcl(long double arg);
It takes in a single value of type long double and computes its complementary error function. It then returns the answer of type long double.
The erfcl function returns special values for certain arguments:
| Special Value | Returned | 
|---|---|
| +INFINITY | +0 | 
| -INFINITY | +2 | 
NAN | 
NAN | 
The following code snippet shows how we can use the erfcl function:
#include <stdio.h> // Including header file for printf function#include <tgmath.h> // Including header file for erfcl functionint main (){long double param, result;param = 1.5;result = erfcl(param);printf("erfcl (%Lf) = %Lf\n", param, result);return 0;}
Free Resources