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 x is a NaN, a NaN is returned. (nan in, nan out, the circle of life πŸŒ€)
  • If x is +0 or -0, 1 is returned.
  • If x is positive infinity, +0 is returned.
  • If x is negative infinity, +2 is 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-rolling 1-erf(x) for big x, 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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms