21 static inline xsimd::batch<float, A>
erf(
const xsimd::batch<float, A> x)
29 using float_v = xsimd::batch<float, A>;
30 using float_m =
typename float_v::batch_bool_type;
31 float_v xa = xsimd::abs(x);
32 float_m precisionLimit = xa >= float_v(9.3f);
35 float_m invertMask = x < float_v(0.f);
36 sign = xsimd::select(invertMask, float_v(-1.f),
sign);
39 float a1 = 0.254829592f;
40 float a2 = -0.284496736f;
41 float a3 = 1.421413741f;
42 float a4 = -1.453152027f;
43 float a5 = 1.061405429f;
46 float_v t = 1.0f / (1.0f +
p * xa);
47 float_v y = 1.0f - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t * exp(-xa * xa);