CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/DataFormats/Math/interface/approx_erf.h

Go to the documentation of this file.
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