Python Glossary Русский

Python 3.2+Numbers & mathfunction

math.erfc

special functions

The complementary error function 1 − erf(x).

Syntax

math.erfc(...)

It exists precisely for the tail: at x = 10 erf(x) is indistinguishable from 1.0 and 1 - erf(x) yields exactly zero, whereas erfc(10) returns roughly 2e-45. Near zero the roles swap — erfc(x) sits just under 1 and significant digits get eaten, so erf is the accurate one there.

Examples

import math
print(math.erfc(0))   # → 1.0
print(round(math.erfc(1), 4))   # → 0.1573
print(round(math.erf(1) + math.erfc(1), 10))   # → 1.0
print(1 - math.erf(6))   # → 0.0
print(math.erfc(6) > 0)   # → True

See also

Open in the full glossarydocs.python.orgReport an inaccuracy