Skip to content
Ubiquev1.0.4
functionerfcinv
erfcinv(y: number): number

Inverse complementary error function.

Computes the inverse of the complementary error function.

It satisfies y = erfc(x) for 0 ≤ y ≤ 2 with -∞ ≤ x ≤ ∞.

Examples

Compute the inverse complementary error function for a value less than 1

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

assertAlmostEquals(erfcinv(1.5), -0.4769362762044699, 2.384681381022349e-13);

Compute the inverse complementary error function for a value greater than 1

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

assertAlmostEquals(erfcinv(0.5), 0.4769362762044699, 2.384681381022349e-13);

Compute the inverse complementary error function for 1

import { assertEquals, assertAlmostEquals } from "jsr:@std/assert";

assertAlmostEquals(erfcinv(1), -0.0, 1e-14);

Compute the inverse complementary error function for 2 (should return negative infinity)

import { assertEquals } from "jsr:@std/assert";

assertEquals(erfcinv(2), -Infinity);

Compute the inverse complementary error function for 0 (should return positive infinity)

import { assertEquals } from "jsr:@std/assert";

assertEquals(erfcinv(0), Infinity);

Parameters

y: number

A real value in the range [2, 0]

Return Type

number

The value of the inverse complementary error function

Throws

If the input is out of range