erfc(3)
π erfc(3) β complementary error function π
okay bestie, so this one's from the Library Functions Manual (that's the manual name, we love her), and it's all about erfc, erfcf, and erfcl β the complementary error function. no cap, these three are basically the same girl in different fonts: double, float, and long double. β¨
πΈ LIBRARY πΈ
Math library (libm, and you link her with -lm, don't forget the flag or she literally will not show up π
)
β¨ SYNOPSIS β¨
#include <math.h>
double erfc(double x);
float erfcf(float x);
long double erfcl(long double x);
π Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
erfc():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
erfcf(), erfcl():
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
|| /* Since glibc 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
fr fr, if you don't define the right macro the compiler is gonna act like it's never heard of you. define before you #include, okay? π
π¦ DESCRIPTION π¦
These functions return the complementary error function of x, that is, 1.0 - erf(x). that's it, that's the whole vibe. it's giving "one minus erf", iconic, no notes. β¨
π RETURN VALUE π
- On success, these functions return the complementary error function of
x, a value in the range[0,2]. - If
xis a NaN, a NaN is returned. (nan in, nan out, the circle of life π) - If
xis+0or-0,1is returned. - If
xis positive infinity,+0is returned. - If
xis negative infinity,+2is returned. - If the function result underflows and produces an unrepresentable value, the return value is
0.0. - If the function result underflows but produces a representable (i.e., subnormal) value, that value is returned, and a range error occurs.
π ERRORS π
See math_error(7) for info on how to figure out whether an error has happened when you call these functions. (you can't always just tell, bestie, you gotta check.)
The following errors can occur:
- Range error: result underflow (result is subnormal) β An underflow floating-point exception (
FE_UNDERFLOW) is raised.
these functions do not set errno. not even a little. so don't go looking there, she's not home π
π ATTRIBUTES π
For an explanation of the terms used in this section, see attributes(7).
erfc(),erfcf(),erfcl()β Thread safety: MT-Safe
(translation: she's thread-safe, you can share her with all your friends simultaneously π«Ά)
π STANDARDS π
C11, POSIX.1-2008.
β HISTORY β
C99, POSIX.1-2001.
The variant returning double also conforms to SVr4, 4.3BSD.
π§ NOTES π§
The erfc(), erfcf(), and erfcl() functions are provided to avoid the loss of accuracy that would occur for the calculation 1-erf(x) for large values of x (for which the value of erf(x) approaches 1).
so yeah, don't be out here hand-rolling1-erf(x)for bigx, you WILL lose precision and it will be embarrassing. that's literally why these functions exist. use them. π
π SEE ALSO π
and that's the whole page, bestie!! π go forth and compute complementary error functions responsibly. mwah. π
sign-off from the source, as promised: this is Linux man-pages 6.20, dated 2026-02-08, and the page is erfc(3). periodt. πβ¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 1996, Andries E. Brouwer <aeb@cwi.nl>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms