00001 #ifndef APPROX_ERF_H 00002 #define APPROX_ERF_H 00003 #include "DataFormats/Math/interface/approx_exp.h" 00004 00005 inline 00006 float approx_erf(float x) { 00007 auto xx = std::min(std::abs(x),5.f); 00008 xx*=xx; 00009 return std::copysign(std::sqrt(1.f- unsafe_expf<4>(-xx*(1.f+0.2733f/(1.f+0.147f*xx)) )),x); 00010 // return std::sqrt(1.f- std::exp(-x*x*(1.f+0.2733f/(1.f+0.147f*x*x)) )); 00011 } 00012 00013 00014 #endif