erfInv

Computes the inverse error function at x.

Returns the value y such that erf(y) = x. This is used internally to compute quantiles of the normal distribution. Uses Winitzki's rational approximation as an initial guess, refined with four iterations of Newton's method for high precision.

Example:

erfInv(0.0)                // 0.0
erfInv(erf(1.0)) // 1.0 (round-trip)
erfInv(0.8427007929497149) // 1.0 (since erf(1) ≈ 0.8427)

Return

the inverse error function value at x.

Parameters

x

the value at which to evaluate. Must be strictly between -1 and 1 (exclusive).