Namespaces
Variants
Views
Actions

erfc

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
erfc
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       erfcf( float arg );
(since C99)
double      erfc( double arg );
(since C99)
long double erfcl( long double arg );
(since C99)

Computes the complementary error function of arg.

Contents

[edit] Parameters

arg - floating point value

[edit] Return value

The value of the complementary error function of arg, that is 1-erf(arg).

[edit] Example

#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
#include <float.h>
 
int main()
{
    printf("erfc(0.5)       = %f\n",    erfc(0.5));
    printf("erf(0.5)        = %f\n",    erf(0.5));         /* complement of erfc */
    printf("erfc(+0.0)      = %f\n",    erfc(+0.0));
    printf("erfc(-0.0)      = %f\n",    erfc(-0.0)); 
    printf("erfc(+INFINITY) = %+.1f\n", erfc(+INFINITY));
    printf("erfc(-INFINITY) = %+.1f\n", erfc(-INFINITY));
    printf("erfc(NAN)       = %f\n",    erfc(NAN));
    printf("\n");
 
    return 0;
}

Possible output:

erfc(0.5)       = 0.479500
erf(0.5)        = 0.520500
erfc(+0.0)      = 1.000000
erfc(-0.0)      = 1.000000
erfc(+INFINITY) = +0.0
erfc(-INFINITY) = +2.0
erfc(NAN)       = nan

[edit] See also

(C99)
error function
(function) [edit]

[edit] External links

Weisstein, Eric W. "Erfc." From MathWorld--A Wolfram Web Resource.