| 1 |
'\" t |
| 2 |
.\" Copyright 1996, Andries E. Brouwer <[email protected]> |
| 3 |
.\" Copyright, the authors of the Linux man-pages project |
| 4 |
.\" |
| 5 |
.\" SPDX-License-Identifier: Linux-man-pages-copyleft |
| 6 |
.\" |
| 7 |
.TH erfc 3 2026-02-08 "Linux man-pages 6.18" |
| 8 |
.SH NAME |
| 9 |
erfc, erfcf, erfcl \- complementary error function |
| 10 |
.SH LIBRARY |
| 11 |
Math library |
| 12 |
.RI ( libm ,\~ \-lm ) |
| 13 |
.SH SYNOPSIS |
| 14 |
.nf |
| 15 |
.B #include <math.h> |
| 16 |
.P |
| 17 |
.BI "double erfc(double " x ); |
| 18 |
.BI "float erfcf(float " x ); |
| 19 |
.BI "long double erfcl(long double " x ); |
| 20 |
.fi |
| 21 |
.P |
| 22 |
.RS -4 |
| 23 |
Feature Test Macro Requirements for glibc (see |
| 24 |
.BR feature_test_macros (7)): |
| 25 |
.RE |
| 26 |
.P |
| 27 |
.BR erfc (): |
| 28 |
.nf |
| 29 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE |
| 30 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 31 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 32 |
.fi |
| 33 |
.P |
| 34 |
.BR erfcf (), |
| 35 |
.BR erfcl (): |
| 36 |
.nf |
| 37 |
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L |
| 38 |
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE |
| 39 |
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE |
| 40 |
.fi |
| 41 |
.SH DESCRIPTION |
| 42 |
These functions return the complementary error function of |
| 43 |
.IR x , |
| 44 |
that is, 1.0 \- erf(x). |
| 45 |
.SH RETURN VALUE |
| 46 |
On success, these functions return the complementary error function of |
| 47 |
.IR x , |
| 48 |
a value in the range [0,2]. |
| 49 |
.P |
| 50 |
If |
| 51 |
.I x |
| 52 |
is a NaN, a NaN is returned. |
| 53 |
.P |
| 54 |
If |
| 55 |
.I x |
| 56 |
is +0 or \-0, 1 is returned. |
| 57 |
.P |
| 58 |
If |
| 59 |
.I x |
| 60 |
is positive infinity, |
| 61 |
+0 is returned. |
| 62 |
.P |
| 63 |
If |
| 64 |
.I x |
| 65 |
is negative infinity, |
| 66 |
+2 is returned. |
| 67 |
.P |
| 68 |
If the function result underflows and produces an unrepresentable value, |
| 69 |
the return value is 0.0. |
| 70 |
.P |
| 71 |
If the function result underflows but produces a representable |
| 72 |
(i.e., subnormal) value, |
| 73 |
.\" e.g., erfc(27) on x86-32 |
| 74 |
that value is returned, and |
| 75 |
a range error occurs. |
| 76 |
.SH ERRORS |
| 77 |
See |
| 78 |
.BR math_error (7) |
| 79 |
for information on how to determine whether an error has occurred |
| 80 |
when calling these functions. |
| 81 |
.P |
| 82 |
The following errors can occur: |
| 83 |
.TP |
| 84 |
Range error: result underflow (result is subnormal) |
| 85 |
.\" .I errno |
| 86 |
.\" is set to |
| 87 |
.\" .BR ERANGE . |
| 88 |
An underflow floating-point exception |
| 89 |
.RB ( FE_UNDERFLOW ) |
| 90 |
is raised. |
| 91 |
.P |
| 92 |
These functions do not set |
| 93 |
.IR errno . |
| 94 |
.\" It is intentional that these functions do not set errno for this case |
| 95 |
.\" see https://www.sourceware.org/bugzilla/show_bug.cgi?id=6785 |
| 96 |
.SH ATTRIBUTES |
| 97 |
For an explanation of the terms used in this section, see |
| 98 |
.BR attributes (7). |
| 99 |
.TS |
| 100 |
allbox; |
| 101 |
lbx lb lb |
| 102 |
l l l. |
| 103 |
Interface Attribute Value |
| 104 |
T{ |
| 105 |
.na |
| 106 |
.nh |
| 107 |
.BR erfc (), |
| 108 |
.BR erfcf (), |
| 109 |
.BR erfcl () |
| 110 |
T} Thread safety MT-Safe |
| 111 |
.TE |
| 112 |
.SH STANDARDS |
| 113 |
C11, POSIX.1-2008. |
| 114 |
.SH HISTORY |
| 115 |
C99, POSIX.1-2001. |
| 116 |
.P |
| 117 |
The variant returning |
| 118 |
.I double |
| 119 |
also conforms to |
| 120 |
SVr4, 4.3BSD. |
| 121 |
.SH NOTES |
| 122 |
The |
| 123 |
.BR erfc (), |
| 124 |
.BR erfcf (), |
| 125 |
and |
| 126 |
.BR erfcl () |
| 127 |
functions are provided to avoid the loss accuracy that |
| 128 |
would occur for the calculation 1-erf(x) for large values of |
| 129 |
.I x |
| 130 |
(for which the value of erf(x) approaches 1). |
| 131 |
.SH SEE ALSO |
| 132 |
.BR cerf (3), |
| 133 |
.BR erf (3), |
| 134 |
.BR exp (3) |