erfc(x: number): number
Complementary error function.
Calculates the complementary error function, which is widely used in probability, statistics, and partial differential equations.
The complementary error function is defined as:
2 ∞ erfc(x) = ─── ∫ e^(-t²) dt = 1 - erf(x) √π x
This implementation provides an approximation with a high degree of accuracy.
Compute the complementary error function for a single value
Compute the complementary error function for a single value
import { assertEquals } from "jsr:@std/assert"; assertEquals(erfc(0.5), 0.47950009227675744);
Compute the complementary error function for a negative value
Compute the complementary error function for a negative value
import { assertEquals } from "jsr:@std/assert"; assertEquals(erfc(-1), 1.8427007877600068);
Compute the complementary error function for zero
Compute the complementary error function for zero
import { assertEquals } from "jsr:@std/assert"; assertEquals(erfc(0), 1);