Quick and dirty, tolerance under + -6e-3. Work based on the "Convenient approximation of the error function and its inverse" by Sergey Vinitsky.
C / C ++ CODE:
float myErfInv2(float x){ float tt1, tt2, lnx, sgn; sgn = (x < 0) ? -1.0f : 1.0f; x = (1 - x)*(1 + x);
Checking the performance of MATLAB:
clear all, close all, clc x = linspace(-1, 1,10000); a = 0.147; u = log(1-x.^2); u1 = 2/(pi*a) + u/2; u2 = u/a; y = sign(x).*sqrt(-u1+sqrt(u1.^2 - u2)); f = erfinv(x); axis equal figure(1); plot(x, [y;f]); figure(2); e = fy; plot(x, e);
MATLAB Charts:

nimig18
source share