ERFC(3POSIX)
π ERFC(3POSIX) β bestie edition π
okay so this is ERFC(3POSIX), from the POSIX Programmer's Manual, and we're about to make complementary error functions your whole personality. let's go π«Ά
πΈ PROLOG
so like, heads up: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so pls consult the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface might not even be implemented on Linux at all. π
β¨ NAME
erfc, erfcf, erfcl β the complementary error functions, aka the math girlies π
π SYNOPSIS
#include <math.h>
double erfc(double x);
float erfcf(float x);
long double erfcl(long double x);
three flavors, one vibe. pick your precision bestie β¨
π DESCRIPTION
okay so first things first: everything described on this reference page is aligned with the ISO C standard. if there's any conflict between what's written here and the ISO C standard, that conflict is unintentional, no cap. this volume of POSIX.1β2017 defers to the ISO C standard. periodt.
these functions shall compute the complementary error function 1.0 - erf(x).
now if you're an application that wants to check for error situations, here's the move π§: set errno to zero and call feclearexcept(FE_ALL_EXCEPT) before calling these functions. then on return, if errno is non-zero, or if fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) is non-zero β boom, an error has occurred. π
π₯ RETURN VALUE
upon successful completion, these functions shall return the value of the complementary error function. slay.
if the correct value would cause underflow, and it's not representable, a range error may occur, and erfc(), erfcf(), and erfcl() shall return 0.0, or (if the IEC 60559 Floating-Point option is not supported) an implementation-defined value no greater in magnitude than DBL_MIN, FLT_MIN, and LDBL_MIN, respectively.
- if
xisNaN, aNaNshall be returned. π - if
xisΒ±0,+1shall be returned. - if
xis-Inf,+2shall be returned. - if
xis+Inf,+0shall be returned.
and if the correct value would cause underflow and it is representable, a range error may occur and the correct value shall be returned. we love a comeback story. π
π ERRORS
these functions may fail if:
- Range Error β the result underflows.
if the integer expression (math_errhandling & MATH_ERRNO) is non-zero, then errno shall be set to [ERANGE]. if the integer expression (math_errhandling & MATH_ERREXCEPT) is non-zero, then the underflow floating-point exception shall be raised.
the following sections are informative, bestie. don't @ me.
π EXAMPLES
None. β literally nothing, the example section said "not me showing up empty" π
π APPLICATION USAGE
so why does erfc() even exist? because of the extreme loss of relative accuracy if you call erf(x) for large x and then subtract the result from 1.0. it's giving catastrophic cancellation, and we simply will not be doing that. π«
also, on error, the expressions (math_errhandling & MATH_ERRNO) and (math_errhandling & MATH_ERREXCEPT) are independent of each other β but at least one of them must be non-zero. iykyk.
π¦ RATIONALE
None. β iconic, unbothered, no notes π
β FUTURE DIRECTIONS
None. β the future is bright and it is empty β¨
πΈ SEE ALSO
erf()feclearexcept()fetestexcept()isnan()
and from the Base Definitions volume of POSIX.1β2017: Section 4.20, Treatment of Error Conditions for Mathematical Functions, and <math.h>.
π COPYRIGHT
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! brought to you by IEEE/The Open Group, 2017, signing off from ERFC(3POSIX) πβ¨π go forth and compute your complementary error functions with main character energy π¦π
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms