function erfcinv
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 } from "jsr:@std/assert";

assertEquals(erfcinv(1.5), -0.476936236121904);

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

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

assertEquals(erfcinv(0.5), 0.476936236121904);

Compute the inverse complementary error function for 1

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

assertEquals(erfcinv(1), 0);

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